Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to make a time-line with events by means of tikZ. Everything is going fine, I found (here) some nice examples and explanations but... I do a brace decoration for my time-line which has long "caption". What I'm trying is to make this caption multi-line, but it's not working. For example, in the text for node I can put \\ inside the text and it makes the text two line. But this way is totally useless in text for the brace decoration. the minimum example is like next

\documentclass[a4paper,12pt,oneside,titlepage]{report} \usepackage{tikz} \usetikzlibrary{snakes, positioning, decorations.pathreplacing, calc} \tikzset{ date labels/.style = { % Font font = \sffamily, % Anchor anchor = north, %Angle %rotate = 45 } } \tikzset{ event/.style = { %Shape rectangle, % Size rounded corners = 2mm, % Border thick, draw = #1!50, %Filling fill = #1!20, % Font align = center, font = \sffamily\scriptsize, } } \tikzset{ side labels/.style = { %Shape rectangle, % Size minimum size = 6mm, rounded corners = 2mm, % Border very thick, draw = black!50, %Filling top color = white, bottom color = black!20, % Font font = \sffamily, % Anchor anchor = east, } } \begin{document} \begin{tikzpicture}[line width = 1pt] \node [side labels] at (-1, 0) {Customer A}; \draw[fill = black!100] {[snake] (0, 0)circle[radius=2pt] -- (2, 0)circle[radius=2pt]} -- (7, 0)circle[radius=2pt] -- (9, 0)circle[radius=2pt]; \draw (0, -0.05) node [date labels] {1} -- (0, 0.05) node (paid_date) {}; \draw (2, -0.05) node [date labels] {30} -- (2, 0.05) node (paid_back_date) {}; \draw (7, -0.05) node [date labels] {280} -- (7, 0.05) node (next_paid_date) {}; \draw (9, -0.05) node [date labels] {365} -- (9, 0.05) node (stop_date) {}; \begin{scope}[on grid] \node (utility_first) [event = gray] at (-1, 1.25) {$1^{st}$ loan\\utilization}; \draw [gray!50] (utility_first) -- (paid_date); \node (start_monitoring) [event = gray] at (1, 1.25) {start\\monitoring}; \draw [gray!50] (start_monitoring) -- (paid_date); \node (paid_back) [event = gray] at (2.75, 1.25) {$1^{st}$ loan\\paid back}; \draw [gray!50] (paid_back) -- (paid_back_date); \node (utility_second) [event = gray] at (7, 1.25) {$2^{nd}$ loan\\utilization}; \draw [gray!50] (utility_second) -- (next_paid_date); \node (stop_monitoring) [event = gray] at (9, 1.25) {stop\\monitoring}; \draw [gray!50] (stop_monitoring) -- (stop_date); \end{scope} \draw [decorate, decoration = {brace, amplitude = 10pt, mirror}, xshift = 0pt, yshift = -42pt] ($(paid_back_date.south) + (0, -0.5)$) -- ($(stop_date.south) + (0, -0.5)$) node [black, midway, xshift = 0cm, yshift = -0.6cm] {\scriptsize ``real'' $2^{nd}$ loan utilization period under monitoring = $335$ days}; \end{tikzpicture} \end{document}

what I want is to have the caption for the brace displayed in two lines instead of 1. Any help would be greatly appreciated!

share|improve this question
add comment

1 Answer

There are two possibilities: You can either specify a text width=<length> for the node, which will automatically break the text if it exceeds the <length>, or you can supply an align=<alignment option> and manually break your text using \\.

So, either

node [align=center,midway,anchor=north,yshift=-1.5ex,font=\scriptsize] { ``real'' $2^{nd}$ loan utilization period\\under monitoring = $335$ days};

or

node [align=center,text width=5cm,midway,anchor=north,yshift=-1.5ex,font=\scriptsize] {``real'' $2^{nd}$ loan utilization period under monitoring = $335$ days};   

will yield

share|improve this answer
    
Yes, that's work. Thank you! –  Oleksandr Apr 5 '12 at 15:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.