5

When using standalone or article class, my TikZ figure renders as it should. But when changing to tufte-handout, I get some misalignments. Why is this? How can I solve it?

With tufte-handout, wrong

With article class, ok

The code of the figure in the following MWE is taken from the answer of @Tarass to this other question: Dimensioning of a technical drawing in TikZ. At first I thought it was a problem with his \Cote command (as the cotes appeared to be completely messed), but removing all but the figure, revealed this misalignment with the circle.

\documentclass[twoside,a4paper]{tufte-handout}
%\documentclass{article} %uncomment this to see what's happening
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\small
\draw[thick,blue,fill=blue!25]
        (0,1) coordinate (A)
    --  (3,1) coordinate (B)
    --  (5,2) coordinate (C)
    --  (5,4) coordinate (D)
    --  (3,4) coordinate (E)
    --  (2.5,3) coordinate (F)
    --  (2,4) coordinate (G)
    --  (0,4) coordinate (H)
    --cycle ;

\draw[red,fill=red!25] (2.5,3.9) circle (.39) ;

\end{tikzpicture}
\end{document}
  • 1
    Remove \small... – Paul Gaborit Nov 23 '14 at 8:54
  • 2
    Or put \small before \begin{tikzpicture} , not inside it. – user11232 Nov 23 '14 at 9:04
  • Thanks. This \smallwas not so inoffensive at all... – Pablo B. Nov 23 '14 at 9:06
  • This looks very much like a bug in tufte-handout: try inverting the order in which the \draw commands are issued (keeping \small). – egreg Nov 23 '14 at 11:30
  • @egreg Inverting the drawcommands results even worse. – Pablo B. Nov 23 '14 at 15:30
5

the class apparently sets up \small to set \spaceskip which seems wrong in general and is a disaster inside a tikzpicture You can avoid the problem by moving \small or you can reset \spaceskip:

\documentclass[twoside,a4paper]{tufte-handout}
%\documentclass{article} %uncomment this to see what's happening
\usepackage{tikz}

\begin{document}


\begin{tikzpicture}
\small
\spaceskip0pt
\draw[thick,blue,fill=blue!25]
        (0,1) coordinate (A)
    --  (3,1) coordinate (B)
    --  (5,2) coordinate (C)
    --  (5,4) coordinate (D)
    --  (3,4) coordinate (E)
    --  (2.5,3) coordinate (F)
    --  (2,4) coordinate (G)
    --  (0,4) coordinate (H)
    --cycle ;

\draw[red,fill=red!25] (2.5,3.9) circle (.39) ;

\end{tikzpicture}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.