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.

I have the following image

enter image description here

that was created with this code:

\documentclass[varwidth=true, border=2pt]{standalone}
\usepackage{tikz}
\usepackage{tkz-euclide}

\begin{document}
\usetkzobj{all}
\begin{tikzpicture}
    \tkzSetUpPoint[shape=circle,size=10,color=black,fill=black]
    \tkzSetUpLine[line width=1]
    \tkzDefPoints{0/0/A, 3/0/B', 2/2/C, 4/4/C'}
    \tkzDefLine[parallel=through C](B',C') \tkzGetPoint{Phelper}
    \tkzInterLL(A,B')(C,Phelper) \tkzGetPoint{B}
    \tkzDrawLine[add=0 and 0.2](A,B')
    \tkzDrawLine[add=0 and 0.2](A,C')
    \tkzDrawSegment(B',C')

    \node at ($(A)+(-0.1,-0.2)$)  {$A$};
    \node at ($(B')+(0.2,-0.2)$)  {$B'$};
    \node at ($(C')+(0,0.4)$)  {$C'$};
    \node at ($(B)+(0.2,-0.2)$)  {$B$};
    \node at ($(C)+(0.28,0.5)$)  {$C$};
    \tkzDrawPolygon[ultra thick,color=blue,fill=blue!20](A,B',C') 
    \tkzDrawPolygon[line width=0.3pt,color=red,fill=red!20](A,B,C) 
    \tkzDrawPoints(A,B',C',B,C)
    \tkzLabelSegment[below,red](A,B){$c$}
    \tkzLabelSegment[left,red](A,C){$b$}
    \tkzLabelSegment[right,red](B,C){$a$}
    \tkzLabelSegment[below,blue,pos=0.8](A,B'){$c'$}
    \tkzLabelSegment[left,blue,pos=0.8](A,C'){$b'$}
    \tkzLabelSegment[right,blue](B',C'){$a'$}
\end{tikzpicture}
\end{document}

As you might notice, the space above C' is bigger than necessary. This is because of Phelper. I need Phelper for the construction, but it should not influence the image size in any way. I've tried to get Phelper closer to C, but that seems not to be possible.

How can I stop defined (but not visible) points from influencing image size?

Please note: I wrap code like this in a figure. So images like the one above are only a part of the whole document. So working with standalone does not solve my problem.

share|improve this question
    
You can use the pgfinterruptboundingbox environment as in e.g. tex.stackexchange.com/questions/130193 and tex.stackexchange.com/questions/23332 Place the line defining Phelper in this environment. –  Torbjørn T. Jan 22 at 6:59

1 Answer 1

up vote 3 down vote accepted

Add the key /tikz/overlay to the command that defines the coordinate Phelpher (which is actually the \tkzDefLine command). This key says "Don't use this construction when computing the bounding box.". It's the single-key version of pgfinterruptboundingbox that Torbjørn refers to in his comment. As tkz macros use their own keys, and don't pass unknown keys on to tikz, you need the /tikz/ prefix.

\documentclass[varwidth=true, border=2pt]{standalone}
%\url{http://tex.stackexchange.com/q/155343/86}
\usepackage{tikz}
\usepackage{tkz-euclide}

\begin{document}
\usetkzobj{all}
\begin{tikzpicture}
    \tkzSetUpPoint[shape=circle,size=10,color=black,fill=black]
    \tkzSetUpLine[line width=1]
    \tkzDefPoints{0/0/A, 3/0/B', 2/2/C, 4/4/C'}
    \tkzDefLine[parallel=through C,/tikz/overlay](B',C') \tkzGetPoint{Phelper}
    \tkzInterLL(A,B')(C,Phelper) \tkzGetPoint{B}
    \tkzDrawLine[add=0 and 0.2](A,B')
    \tkzDrawLine[add=0 and 0.2](A,C')
    \tkzDrawSegment(B',C')

    \node at ($(A)+(-0.1,-0.2)$)  {$A$};
    \node at ($(B')+(0.2,-0.2)$)  {$B'$};
    \node at ($(C')+(0,0.4)$)  {$C'$};
    \node at ($(B)+(0.2,-0.2)$)  {$B$};
    \node at ($(C)+(0.28,0.5)$)  {$C$};
    \tkzDrawPolygon[ultra thick,color=blue,fill=blue!20](A,B',C') 
    \tkzDrawPolygon[line width=0.3pt,color=red,fill=red!20](A,B,C) 
    \tkzDrawPoints(A,B',C',B,C)
    \tkzLabelSegment[below,red](A,B){$c$}
    \tkzLabelSegment[left,red](A,C){$b$}
    \tkzLabelSegment[right,red](B,C){$a$}
    \tkzLabelSegment[below,blue,pos=0.8](A,B'){$c'$}
    \tkzLabelSegment[left,blue,pos=0.8](A,C'){$b'$}
    \tkzLabelSegment[right,blue](B',C'){$a'$}
\end{tikzpicture}
\end{document}

before and after shots

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.