ngTagInput : Dynamic coloring tags and resizable input box - ng-tags-input

Is there any way, I can color a tag(with different colors) on on-tag-adding event, for a tag entered by user which is not a part of suggestion list? i.e. as a warning to user that he is going to add unknown tag(in red?)
also, How Can I make input box re-sizable vertically as we add more and more tags?

Related

treemap can't render box when containing text that is too large

When creating a treemap structure with boxes, boxes with a text that is larger than the box itself are not drawn.
Below the same treemap is show twice: once with text, once without text.
treemap with text
image without text
How do I prevent this from happening?
I'm pretty sure this can't be prevented. The reason is that the box sizes have hard constraints on their sizes (the size is as meaningful as the height of a bar in a bar chart), so they can't grow with the size of the enclosed text.
To fix this you could generate shorter labels (removing all the vowls and truncating them) and showing the full label as a tooltip? Or you could have a box with a label in it on the side which contains the currently hovered box?

How do you rotate a text

There is a video on how to rotate an object around a point but I fail to select the text.
I wanted to do the same thing and saw your question before figuring this out.
1. The "Geogebra Way"
In the Algebra Perspective enter the following RotateText commands in the Input box at the bottom:
RotateText["Rotated text using degrees.", 45°]
RotateText["Rotated text using radians.", 0.785398]
In the Construction Protocol view, this is represented by
"rotatebox{45}{ \text{Rotated text using degrees.} }"
"rotatebox{44.9999999}{ \text{Rotated text using radians.} }"
Note that the radian form of the RotateText command is converted to degrees in the construction step. So this creates an graphical object that renders the text in a LaTeX "rotatebox". It's rather strange that the system doesn't have a tool to create rotateable text.
You can attach the text to an object via the object's Properties->Position->Starting Point. Only certain types of objects can be used, and the text can only be placed/moved underneath the object, which is odd. You can get around this by creating a line segment, attaching the rotateable text object to a desired end-point on the line segment above the location you want the final text, and then hiding the line segment.
2. A better, "undocumented" Geogebra method!
One can actually use LaTeX in captions of objects. Here's how you would enter the text:
$\rotatebox{45}{ \text{Rotated text using standard text box!} }$
A nice thing about this is the caption can be easily placed above the object. Notice that LaTeX commands are surrounded by the dollar sign. Also notice that there is a backslash as part of the \rotatebox command.
Also, one can use the standard text tool to do the same thing. This has the advantage that the text can be dynamic! Create some text anywhere. Then edit it's properties on the Text tab. Check the LaTeX checkbox, and enter the following for the text:
$\rotatebox{45}{ \text{} }$
Then inside the \text{} brackets, select an object. The text will be updated with the object's value. Or a combined form:
$\rotatebox{45}{ \text{"The value is:" + SliderObject} }$
I've tried to put an object in the "degreees" field, but could not get that to work.
Use the RotateText command like this:
RotateText("What ever text you want", angle)

Word Openxml: how to get a text box the right size?

I'm using PHP to generate docx documents from a database. The generated document contains column charts which have labels attached (i.e. user shapes containing textboxes). In an attempt to get the textboxes to accommodate and display all of the text (i.e. it shouldn't be necessary for the user to resize a textbox to see all the text) my code calculates how many characters will fit into 3cm, adds linefeeds to the string as required and tells me how many lines of text are needed. I have:
<a:xfrm xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
<a:off x="1638276" y="1676399"/>
<a:ext cx="1257325" cy="'.(252000 * $labelLeftLines).'"/>
</a:xfrm>
which I believe should give me a text box around 3.5cm wide (extra .5 for the internal padding) and a height of .7cm multiplied by whatever is the value of $labelLeftLines. However, the text box always turns up as 3.cm wide by .86cm high, which only ever displays one line of text.
If I add in 'autofit':
<a:bodyPr xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" vertOverflow="clip" wrap="square" rtlCol="0">
<a:spAutoFit/>
</a:bodyPr>
the generated file looks just the same, though, when I right click on the textbox to inspect the properties, 'autofit' is indeed applied. I have to uncheck it and recheck it to make it affect the textbox.
Any openXML gurus out there?
Hmm, some random floundering around revealed that the values I need to manipulate are here:
<cdr:relSizeAnchor xmlns:cdr="http://schemas.openxmlformats.org/drawingml/2006/chartDrawing">
<cdr:from>
<cdr:x>0.47</cdr:x>
<cdr:y>0.75</cdr:y>
</cdr:from>
<cdr:to>
<cdr:x>0.67</cdr:x>
<cdr:y>1</cdr:y>
</cdr:to>
Changing those values does actually change the size of the texbox, though I haven't a clue what units are being used. From 0.75 to 1 produces a height of 1.43cm.
One day I'll maybe be able to find my way around the doucmentation.

Latex color box inline with text

I'm trying to put together a LaTeX color box. The xcolor package \fcolorbox seem to be what I want, but I can't get the rendering quite correct. When I use
\fcolorbox{black}{red}{}
it renders a small box sunken to the bottom of the text line. The best I've managed to do is to fake it with a similar text color:
\fcolorbox{black}{red}{\textcolor{red}{--}}
However, I'm worried that this won't render correctly in all situations with defined colors. Is there a way I can declare an empty text box with full in-line text height? Is there another solution?
I'm basically looking for the code that produces the color boxes all through the document at ftp://ftp.dante.de/pub/tex/macros/latex/contrib/xcolor/xcolor.pdf. The boxes I'm referring to are used throughout, but the first instance is on page 4. Thanks.
The xcolor.dtx file in the same directory as the pdf contains the source for the package and the source for the documentation. The relevant bits from the source for the documentation:
\def\testclr#1#{\#testclr{#1}}
\def\#testclr#1#2{{\fboxsep\z#\fbox{\colorbox#1{#2}{\phantom{XX}}}}}
...
(Answer: 40\% \testclr{green} $+$ 60\% \testclr{yellow} $=$ \testclr{green!40!yellow}, e.g., |\color{green!40!yellow}|)
Basically, use \phantom{} on the contents of your color box, and make sure that at least one of the phantom characters is full-height.
Also, https://tex.stackexchange.com/

BiDi text in Delphi - How do you select text to edit by language like this pic?

I saw this picture and now wondering if/how you can do this in Delphi. The highlighted/selected text shows two forms of formatting, i.e. highlight color and hash lines.
http://img9.imageshack.us/img9/4121/easilyselecttextofonela.jpg
I've done something very similar recently in a bible application, also done in Delphi.
The user can select a single verse and single words of the selected verses. (But this feature is not released yet, so don't bother looking for it)
I used the web browser control from Microsoft and added my own kind of selection handling.
I've done the formatting by enclosing the relevant parts with span elements and changing their CSS style. When the selection gets removed, I also remove the enclosing elements.
The hard part was backing the "visual" selections with a selection data structure and handling all the selection events (clicking, shift-clicking, shift-ctrl-clicking, ...)
Embedding IE seems to be an easier way to do this as DR says, but you can also do this manually by drawing it all on a canvas, an easy way would be to create two bitmaps (one without a selection and another selected (could be as complicated as you like - dashed, colored, ... )), and you need to know the positions/rects of all your characters which would be somewhat difficult for long texts.
You basically show the unselected bitmap, and overlap the selected parts by portions of the second image.
You would also need to handle the selection manually by OnMouseDown, OnMouseMove, OnMouseUp...

Resources