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.

Another minimal example:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}

\node[draw=black,%
rounded corners=2pt,%
rectangle,%
bottom color=black!80!white] (A) {node aligned on left margin}; 

\node[draw=black,%
rounded corners=2pt,% 
rectangle,% 
bottom color=black!80!white] {node aligned on the right margin};


\end{tikzpicture}
\end{document}

in this case I'd like to have the first node aligned on the left margin of the paper and the second one on the right.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I suggest you try it this way:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\path (0,0) node[draw=black, rounded corners=2pt, rectangle, bottom color=black!80!white, anchor=west] (A) {node aligned on left margin} -- (\textwidth,0) node[draw=black, rounded corners=2pt, rectangle, bottom color=black!80!white, anchor=east] (B) {node aligned on the right margin};
\end{tikzpicture}
\end{document}

The nodes are on a path, which spans the width of the text on the page (\textwidth).

The anchors of the nodes are necessary to make sure the nodes do not get off the page.

share|improve this answer
1  
Instead of anchor=west,anchor=east I find right,left to be more intuitive. –  Peter Grill Sep 28 '11 at 15:09

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.