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.

Why the this three nodes are centered instead of be flushed right ?

enter image description here

\documentclass{article}
\usepackage{tikz,fourier}

\begin{document}
\xdef\LW{.99*241pt}%\linewidth
\xdef\BLS{\baselineskip} 

\begin{tikzpicture}[y={(0,-\BLS)},inner sep=0pt,outer sep=0pt]

\node[draw,minimum width=1.2,minimum height=2.5*\BLS,text width=1cm,align=flush center,font=\scriptsize] (11) at (0,0) {Poids jusqu'\`a} ; 

\node[draw,anchor=north west,minimum width=(\LW-1.2cm),minimum height=\BLS,] at (11.north east) {Tarifs nets (\$)};

\node[draw,anchor=south west,minimum width=(\LW-1.2cm)*.24,minimum height=1.5*\BLS,align=flush center,font=\scriptsize,text width=1.6cm] (22) at (11.south east) {Vers France m\'etropolitaine};

\node[draw,anchor=south west,minimum width=(\LW-1.2cm)*.38,minimum height=1.5*\BLS,align=flush center,font=\scriptsize,text width=1.8cm] (23) at (22.south east) {Vers zone outre-mer 1};

\node[draw,anchor=south west,minimum width=(\LW-1.2cm)*.38,minimum height=1.5*\BLS,align=flush center,font=\scriptsize,text width=1.8cm] at (23.south east) {Vers zone outre-mer 2};

\foreach \t [count=\i from 2,evaluate=\i as \j using int(\i+1)] in {%
{0,56}\,\$,
{0,90}\,\$,
{6,04}\,\$} {%
\node[draw,anchor=north east,align=flush right, minimum height=\BLS,minimum width=(\LW-1.2cm)*.24] (\j2) at (\i2.south east) {\t};
}
\end{tikzpicture}
\end{document}
share|improve this question

1 Answer 1

up vote 7 down vote accepted

To align you need a box of the given width. For this you have to provide text width. If you wish you may also provide minimum width.

\node[draw,anchor=north east,align=flush right, minimum height=\BLS,text width=(\LW-1.2cm)*.24] (\j2) at (\i2.south east) {\t};

Full code:

\documentclass{article}
\usepackage{tikz,fourier}

\begin{document}
\xdef\LW{.99*241pt}%\linewidth
\xdef\BLS{\baselineskip}

\begin{tikzpicture}[y={(0,-\BLS)},inner sep=0pt,outer sep=0pt]

\node[draw,minimum width=1.2,minimum height=2.5*\BLS,text width=1cm,align=flush center,font=\scriptsize] (11) at (0,0) {Poids jusqu'\`a} ;

\node[draw,anchor=north west,minimum width=(\LW-1.2cm),minimum height=\BLS,] at (11.north east) {Tarifs nets (\$)};

\node[draw,anchor=south west,minimum width=(\LW-1.2cm)*.24,minimum height=1.5*\BLS,align=flush center,font=\scriptsize,text width=1.6cm] (22) at (11.south east) {Vers France m\'etropolitaine};

\node[draw,anchor=south west,minimum width=(\LW-1.2cm)*.38,minimum height=1.5*\BLS,align=flush center,font=\scriptsize,text width=1.8cm] (23) at (22.south east) {Vers zone outre-mer 1};

\node[draw,anchor=south west,minimum width=(\LW-1.2cm)*.38,minimum height=1.5*\BLS,align=flush center,font=\scriptsize,text width=1.8cm] at (23.south east) {Vers zone outre-mer 2};

\foreach \t [count=\i from 2,evaluate=\i as \j using int(\i+1)] in {%
{0,56}\,\$,
{0,90}\,\$,
{6,04}\,\$} {%
\node[draw,anchor=north east,align=flush right, minimum height=\BLS,text width=(\LW-1.2cm)*.24] (\j2) at (\i2.south east) {\t};
}
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer

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.