[OS X TeX] A tikzpic problem

Vivianne Vilar viviannevilar at gmail.com
Sun Jan 12 23:47:00 CET 2014

On Mon, Jan 13, 2014 at 8:08 AM, Herbert Schulz <herbs at wideopenwest.com>wrote:

>
> On Jan 12, 2014, at 1:35 PM, Don Green Dragon <fergdc at Shaw.ca> wrote:
>
> > Hello Everyone,
> >
> > May the year 2014 bring good fortune and peace to you all. Also, many
> thanks to the people on this list who are so incredibly helpful in giving
> their time to answer and solve such a variety of questions, and who
> continue to keep TeX running on the various platforms.
> >
> > This may be addressed to the wrong mailing list, but at this point I do
> not have a mail connection with the tikz people.
> >
> > I began using tikz drawing program recently in order to create simple
> vector drawings for the document I’m working on. I created four drawings
> and was quite pleased with their appearance on the Preview page. Everything
> was precisely as I wanted. Then the relevant pages were printed to see what
> the drawings  looked like on paper. The disappointment was that of the
> four, only one was true to what I saw in the Preview.  The errors’ — from
> my point of view — are small but clearly visible and the resulting drawing
> is useless.
> >
> > I’m using TeXShop 3.26 running under Mavericks 10.9.1
> >
> > The following lines of code produce the correct’ drawing when viewed on
> the Preview page.
> >
> > \documentclass [11pt, fleqn, leqno] {book}
> > \usepackage{graphicx}
> > \usepackage{epstopdf}
> > % Introduce TikZ package for math drawings
> > \usepackage{tikz}
> >
> > \begin{document}
> >
> > \begin{figure}[htbp]  % Figure 1.4
> > \begin{tikzpicture}
> >  \draw (-0.5, 0) -- (7.5,0) ; % horiz segment
> >  \filldraw (0,0) circle (2pt) node[anchor=north east] {A}; % label point
> (0,0) as A
> >  \filldraw (7,0) circle (2pt) node[anchor=north west] {B}; % label point
> (7,0) as B
> >  \draw [dotted] (0,0) -- (50:9);
> >  \filldraw (50:9) circle (2pt) node [anchor= north west] {$C$};       %
> draw diagonal segment
> >  \foreach \i in {1,...,7}     % place dots along diagonal
> >    \filldraw (50:\i) circle (2pt) node [anchor=south east] {\i};
> >    \draw [dashed] (7,0) -- (50:7);    %  draw segment from 7 to B
> >  % draw lines through 1, 2,..., 6 parallel to line from 7 to B
> >  \foreach \m in {1,...,6}
> >     \draw (50:\m) -- (\m, 0);
> >  \foreach \t in {1,...,6}     % label the points n/7
> >  \filldraw [red] (\t,0) circle (2pt) node [below] {\t/7};
> >  % describe construction process
> >  \draw [xshift=6.8cm, yshift=5cm]
> >    node[right, text width = 7.5cm,fill=green!20]
> >    {The points are constructed as follows:\\
> >    \hspace*{9pt}First the segment $A$ to $B$ is drawn so that the
> distance from $A$ to $B$ is 1 unit
> >     of length. Next construct the diagonal segment from $A$  to $C$
> which we will denote by
> >     $\mathcal{S}$. Then along $\mathcal{S}$ construct the points
> labelled $1,\dots,7$ so that if $d$ is
> >      the distant from $A$ to 1, then the distance from $n$ to $n+1$ is
> also $d$ --- use compass!\\
> >    \hspace*{9pt}Now the dashed segment from 7 to $B$, call it
> $\mathcal{T}$. Finally, construct a
> >    line through point $n$ (= 1, 2, \dots, 6) which is parallel to
> $\mathcal{T}$. The resulting line
> >     intersects the segment from $A$ to $B$ at a  point representing the
> fraction $n/7$. So $A$ is 0/7
> >     and $B$ is 7/7.\\
> >    \hspace*{9pt}The Greeks were capable of carrying out the
> constructions above using only a straight
> >     edge (not a ruler) and a compass.
> >    };
> > \end{tikzpicture}
> > \caption{Construction of Fraction n/7 for n = 1, 2, 3, 4, 5, 6}
> \label{fig1d}
> > \end{figure}
> >
> > \end{document}
> >
> > Furthermore, when the Preview page is printed ''from the above
> skeleton'', the printout is correct. BUT when I print the document page on
> which this figure occurs using my FULL preamble an error occurs. The code
> line that does not print properly is
> >
> > \foreach \t in {1,...,6}      % label the points n/7
> > \filldraw [red] (\t,0) circle (2pt) node [below] {\t/7};
> >
> > which is supposed to print six small red dots (i.e., filled circles) and
> label them  1/7   2/7   …  6/7
> >
> > The red dots appear but are misaligned. On one printout, there were
> translated right about 2 mm and up maybe 0.5 mm. On another printout, the
> red dots were translated left and down.
> >
> > So something in my preamble is interfering, or so it seems, with Tikz
> but I have not a clue where the conflict might occur.
> >
> > Any suggestions?
> >
> > don green dragon
> > fergdc at shaw.ca
>
> Howdy,
>
> It might be helpful if you let us know what else you are including/doing
> in your preamble when things go bad.
>
> PS: Assuming you have a reasonably recent TeX Live there is no need to use
> the epstopdf package; it's already included by the graphicx package. Not
> only htat you also need not use the -shell-escape flag since grapohicx will
> use a restricted (i.e., safe) version of epstopdf automatically.
>
> Good Luck,
>
> Herb Schulz
> (herbs at wideopenwest dot com)
>
>
>
>
> ----------- Please Consult the Following Before Posting -----------
> TeX FAQ: http://www.tex.ac.uk/faq
> List Reminders and Etiquette: http://email.esm.psu.edu/mac-tex/
> List Archive: http://tug.org/pipermail/macostex-archives/
> TeX on Mac OS X Website: http://mactex-wiki.tug.org/
> List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
>

I think this is a good question for tex.stackexchange.com . You will, as
Herbert said, need to say what you include in the full preample, because
without that it is hard to guess what the problem might be.

One way to solve the problem, though possibly not what you are after, is to
create a pdf of the figure first and include this compiled pdf as a figure
in your document. You can do this with the standalone package, code below.
When you insert the compiled pdf figure in your document, you need the

\begin{figure}
\includegraphics{figure}
\caption{}
\end{figure}

Here is the code for the figure to be compiled separately.

\documentclass{standalone}

\usepackage{tikz}
\begin{document}

\begin{tikzpicture}
\draw (-0.5, 0) -- (7.5,0) ; % horiz segment
\filldraw (0,0) circle (2pt) node[anchor=north east] {A}; % label point
(0,0) as A
\filldraw (7,0) circle (2pt) node[anchor=north west] {B}; % label point
(7,0) as B
\draw [dotted] (0,0) -- (50:9);
\filldraw (50:9) circle (2pt) node [anchor= north west] {$C$};        %
draw diagonal segment
\foreach \i in {1,...,7}      % place dots along diagonal
\filldraw (50:\i) circle (2pt) node [anchor=south east] {\i};
\draw [dashed] (7,0) -- (50:7);     %  draw segment from 7 to B
% draw lines through 1, 2,..., 6 parallel to line from 7 to B
\foreach \m in {1,...,6}
\draw (50:\m) -- (\m, 0);
\foreach \t in {1,...,6}      % label the points n/7
\filldraw [red] (\t,0) circle (2pt) node [below] {\t/7};
% describe construction process
\draw [xshift=6.8cm, yshift=5cm]
node[right, text width = 7.5cm,fill=green!20]
{The points are constructed as follows:\\
\hspace*{9pt}First the segment $A$ to $B$ is drawn so that the
distance from $A$ to $B$ is 1 unit
of length. Next construct the diagonal segment from $A$  to $C$
which we will denote by
$\mathcal{S}$. Then along $\mathcal{S}$ construct the points
labelled $1,\dots,7$ so that if $d$ is
the distant from $A$ to 1, then the distance from $n$ to $n+1$ is
also $d$ --- use compass!\\
\hspace*{9pt}Now the dashed segment from 7 to $B$, call it
$\mathcal{T}$. Finally, construct a
line through point $n$ (= 1, 2, \dots, 6) which is parallel to
$\mathcal{T}$. The resulting line
intersects the segment from $A$ to $B$ at a  point representing the
fraction $n/7$. So $A$ is 0/7
and $B$ is 7/7.\\
\hspace*{9pt}The Greeks were capable of carrying out the
constructions above using only a straight
edge (not a ruler) and a compass.
};
\end{tikzpicture}

\end{document}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/macostex-archives/attachments/20140113/aecb4ee3/attachment.html>