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.

In the attached image, you can see the text is not aligning properly. At the end it started to align as required. Sorry I can not reduce the MWE any more. since the preamble in big so I will put that in the comment section. I draw the redlines to show how the text should be aligned.

    \documentclass{article} \usepackage{setspace}\usepackage[left=1in,right=1in,top=1in,bottom=1in]{geometry} \usepackage{fontspec,xltxtra,xunicode}
\usepackage{fancyhdr} \usepackage{color} \usepackage[svgnames]{xcolor} \usepackage{cmll} \usepackage{tabularx,multicol,ulem,array} \usepackage{placeins} 
\usepackage{longtable}
\usepackage{tikz} \usepackage{pgf,pgffor}
\usetikzlibrary{calc} \pagestyle{fancy}
\usetikzlibrary{positioning,shapes,shadows,arrows}
\usetikzlibrary{fit,shapes.geometric}
\newcounter{nodemarkers}
\newcommand\circletext[1]{%
    \tikz[overlay,remember picture] 
        \node (marker-\arabic{nodemarkers}-a) at (0,1.5ex) {};%
    #1%
    \tikz[overlay,remember picture]
        \node (marker-\arabic{nodemarkers}-b) at (0,0){};%
    \tikz[overlay,remember picture,inner sep=2pt]
        \node[draw,ellipse,fit=(marker-\arabic{nodemarkers}-a.center) (marker-\arabic{nodemarkers}-b.center)] {};%
    \stepcounter{nodemarkers}%
}
\hfuzz=45pt
\newcommand\fb\FloatBarrier % to put float barriers
\setmainfont[Script=Devanagari]{Sanskrit2003}
\newcounter{nodecount}
\newcommand\tabnode[1]{\addtocounter{nodecount}{1} \tikz \node (\arabic{nodecount}) {#1};}
\tikzstyle{every picture}+=[remember picture,baseline]
\tikzstyle{every node}+=[inner sep=0pt,anchor=base,
minimum width=1.5cm,align=center,text depth=0.5ex,outer sep=1pt]
\tikzstyle{every path}+=[thick, rounded corners]
\newcommand{\nl}{\\[2mm]}
\begin{document}
.
\vspace{0.5cm} \\
\fb
\begin{table}[!htbp]
\begin{minipage}[b]{1\linewidth} 
\begin{tabular}{c c c c c}
& & \tabnode{}& \tabnode{}&  \tabnode{}\\
प्र० & \tabnode{पु० \nl स्त्री० } & \tabnode{स: \nl सा} & \tabnode{तौ \nl ते} &  \tabnode{ते \nl ता:} 
\end{tabular}
%\
\hspace{2cm}
\begin{tabular}{l l c l}
& \tabnode{}& \tabnode{}&  \tabnode{} \\
प्र० & \tabnode{गच्छति \nl वदति \nl आगच्छति \nl प्रतिगच्छति \nl प्रत्यागच्छति \nl करोति \nl खादति \nl पिबति \nl अस्ति \nl भवति \nl उपविशति \nl तिष्ठति \nl उत्तिष्ठति \nl ददाति \nl गृह्णाति \nl जानाति} & \tabnode{ गच्छतः \nl वदतः \nl आगच्छतः \nl प्रतिगच्छतः \nl प्रत्यागच्छतः \nl कुरुतः \nl खादतः \nl पिबतः \nl स्तः \nl भवतः \nl उपविशतः \nl तिष्ठतः \nl उत्तिष्ठतः \nl दत्तः \nl गृह्णीतः \nl जानीतः} & \tabnode{ गच्छन्ति \nl वदन्ति \nl आगच्छन्ति \nl प्रतिगच्छन्ति \nl प्रत्यागच्छन्ति \nl कुर्वन्ति \nl खादन्ति \nl पिबन्ति \nl सन्ति \nl भवन्ति \nl उपविशन्ति \nl तिष्ठन्ति \nl उत्तिष्ठन्ति \nl ददति \nl गृह्णन्ति \nl जानन्ति} \\
& \tabnode{}& \tabnode{}&  \tabnode{} \\
\end{tabular}
\vspace{2cm}
 \caption{Make simple sentences by joining Nouns \& पठ् धातु forms}
\end{minipage}
\end{table}

\begin{tikzpicture}[overlay]
\draw [Green] (5.west) -- (1.north west) -- (1.north east) -- (5.south east) -- (5.south west) -- cycle;
\draw [red] (6.west) -- (2.north west) -- (2.north east) -- (6.south east) -- (6.south west) -- cycle;
\draw [blue] (7.west) -- (3.north west) -- (3.north east) -- (7.south east) -- (7.south west) -- cycle;

\draw [Green] (14.west) -- (8.north west) -- (8.north east) -- (14.south east) -- (14.south west) -- cycle;
\draw [red] (15.west) -- (9.north west) -- (9.north east) -- (15.south east) -- (15.south west) -- cycle;
\draw [blue] (16.west) -- (10.north west) -- (10.north east) -- (16.south east) -- (16.south west) -- cycle;

\path[-latex] (1.north) edge [bend left,Green] (8.north);
\path[-latex] (2.north) edge [bend left,red] (9.north);
\path[-latex] (3.north) edge [bend left,blue] (10.north);

\end{tikzpicture}
%\doublespacing
it is respectful to address everyone as "त्वम्" in order to address people who are older than you and who deserve respect forms of "भवत्" are used as shown in the image above. 
\end{document}

enter image description here

share|improve this question
    
sorry could not copy the preamble here, so I put that in the question as well –  Raama Apr 17 '12 at 14:54
    
That's actually the way you should do it. –  Martin Scharrer Apr 17 '12 at 15:08
    
A can't compile your code because I don't have the required font installed. It would be good if you remove all unrelated code from the preamble and replace the text with some ASCII placeholder (e.g. "xxx"). Also just to be clear: You want to vertical align the texts in the large green/red/blue boxes, right? Basically the text in the red box is to low? –  Martin Scharrer Apr 17 '12 at 15:19
    
Can I ask what these diagrams are for? I remember answering this question and it seems that you can use the same tricks. –  percusse Apr 17 '12 at 15:20
1  
I would not span \tabnode over lines. This is bad for tabular vertical alignment. Make nodes from cells, which you can use for referencing and drawing. Let tabular handle \\, not \tabnode. –  Stefan Kottwitz Apr 17 '12 at 15:29
show 3 more comments

2 Answers

up vote 3 down vote accepted

Excuse my ignorance but somehow I couldn't get to the proper fonts. So I can only give the matrix version of your code without compiling it. I just replaced all \nl with \\ and placed them into matrix nodes. I am not sure if the sizes would be compatible but it should give you an idea about how to approach it. For referencing to this matrices and individual entries, see the answer in my comment to the question.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix[matrix of nodes,draw=green,rounded corners] (mat1) {
गच्छति \\ वदति \\ आगच्छति \\ प्रतिगच्छति \\प्रत्यागच्छति \\ करोति \\ खादति \\पिबति \\ 
अस्ति \\ भवति \\उपविशति \\ तिष्ठति \\ उत्तिष्ठति \\ ददाति \\ गृह्णाति \\ जानाति\\
};
\matrix[matrix of nodes,draw=red,rounded corners] (mat2) at (3cm,0){
गच्छतः \\ वदतः \\ आगच्छतः \\ प्रतिगच्छतः \\ प्रत्यागच्छतः \\ कुरुतः \\ खादतः \\ पिबतः \\ स्तः \\ 
भवतः \\ उपविशतः \\ तिष्ठतः \\ उत्तिष्ठतः \\ दत्तः \\ गृह्णीतः \\ जानीतः \\
};
\matrix[matrix of nodes,draw=blue,rounded corners] (mat3) at (6cm,0){
गच्छतः \\ वदतः \\ आगच्छतः \\ प्रतिगच्छतः \\ प्रत्यागच्छतः \\ कुरुतः \\ खादतः \\ पिबतः \\ 
स्तः \\ भवतः \\ उपविशतः \\ तिष्ठतः \\ उत्तिष्ठतः \\ दत्तः \\ गृह्णीतः \\ जानीतः \\
};
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
    
I tried your code and yet the rows do not align perfectly I don't know how can I attach an image here. –  Raama Apr 19 '12 at 13:01
    
Can you add the option nodes={minimum height=1.7em} and try again? The problem is that some nodes have text higher than the others and since there is no constraint they shrink down to different sizes. The option I proposed tells that every node should have at least some fixed height. Please try with higher and lower values until it gets right. –  percusse Apr 19 '12 at 13:09
    
@percusse: Instead of minimum height, I would use text height in this case. That ensures that the nodes don't grow and break the alignment. –  Jake Apr 19 '12 at 13:10
    
@Jake I'm not even sure about the problem so this is just to test it. –  percusse Apr 19 '12 at 13:36
add comment

The table on the right contains only 3 rows, with 2 rows nearly empty. You hide the row breaks within your macro \tabnode. This

\tabnode{गच्छति \nl वदति \nl आगच्छति \nl प्रतिगच्छति \nl ... } \\

is actually

\tabnode{गच्छति \\[2mm] वदति \\[2mm] आगच्छति \\[2mm] प्रतिगच्छति \\[2mm]... } \\

To achieve that tabular handles your alignment, take those \\ out:

\tabnode{गच्छति} \\ ...\tabnode{आगच्छति} ... \\

Actually you need \tabnode only a few times for referencing, so don't overuse it. If you would like to make all cells to nodes, a matrix of nodes would be better, as Jake commented, but you only need a few referencing points.

share|improve this answer
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.