On Sat, Feb 12, 2011 at 12:37 PM, ofenerci <ofen...@hotmail.com> wrote:
> I am playing with tikz and want to put the tikz picture inside the
> marginfigure environment. My problem is that the tikz picture doesn't
> scale itself according to the default values of \linewidth' and the
> aspect ratio defined in Tufte-Latex class. I give a random scale
> parameter ( say: 2.0) which is not bad but I want it to have same
> default values of Tufte-latex's. I wonder which parameter I should use
> inside the '\begin{tikzpicture}[scale = ?,width=?]' so that it has
> the same width and height of the 'helix.pdf' figure defined in
> '\includegraphics[width=\linewidth}{helix}.
Let me preface my response by saying that I know a lot less about
TikZ/PGF than I'd like.
The scale factor that you provide the tikzpicture environment affects
the numbers you use within the tikzpicture. So the scaling factor is
entirely up to you.
Here's an example:
\begin{marginfigure}
\parindent=0pt
\parskip=0pt
\begin{center}
\begin{tikzpicture}[scale=\marginparwidth/17in*2.54]%
% spread border
\draw (0.0, 0.0) rectangle (17, -11);
% gutter
\draw (8.5, 0.0) -- (8.5, -11);
% body text blocks
\filldraw[color=gray!30] (1.0, -1.0) rectangle +(4.33333, -8.55555);
\filldraw[color=gray!30] (9.5, -1.0) rectangle +(4.33333, -8.55555);
% sidenotes
\filldraw[color=gray!30] ( 5.66666, -1.0) rectangle
+(\marginparwidth/2.54, -2.0);
\filldraw[color=gray!30] (14.16666, -1.0) rectangle
+(\marginparwidth/2.54, -2.0);
\end{tikzpicture}%
\par\footnotesize Asymmetric page layout
\end{center}
\end{marginfigure}
In this example, I've set the scaling factor to \marginparwidth / 17
in ⋅ 2.54. This means that all the numbers I use to specify
coordinates and lengths within this environment will be in inches.
The entire picture is then scaled down to fit into the
\marginparwidth—that is, the width of the margin note.
To determine the scaling factor you want to use, you'll need to first
decide what units you want to work in within the tikzpicture
environment. Choose whatever units are simplest to draw your image.
Then you can calculate the scaling factor, knowing that the width of
the marginfigure environment is \marginparwidth. (Note that
\linewidth works equally well here and would allow your image to fill
the width of either the margin note area or the text area if you
changed from the marginfigure environment to the figure environment.)
I hope this helps.
--Kevin Godby