2

I have drawn the following figure: enter image description here

As you can see, the arcs are too big for the page. So, I try to scale the image using [scale=0.5].

This works for the straight line segments perfectly. However, instead of scaling the arcs, TikZ does not change the size, but makes their centers closer to each other.

enter image description here

Here is a MWE for the first picture.

\documentclass[a4paper]{article}
\usepackage{tikz}
\tikzset{
    pics/carc/.style args={#1:#2:#3}{
        code={
            \draw[pic actions] (#1:#3) arc(#1:#2:#3);
        }
    }
}
\begin{document}


\begin{figure}[htbp]
    \centering
    \begin{tikzpicture}[scale=0.5]
    \tikzstyle{disk} = [draw, thick, circle,fill=none]
    \tikzstyle{center} = [draw,shape=rectangle,fill=blue]
    \tikzstyle{intersection} = [draw, circle ,fill=darkgray, inner sep=0.8mm]
    \node at (-6,0) {$A$};
    \node at (1,0) {$B$};
    \node at (-2,-6) {$C$};
    \draw[thick] (-8,0)  pic{carc=-100:50:60mm};
    \draw[thick] (2,0)  pic{carc=130:300:60mm};
    \draw[thick,red] (3.2,0)  pic{carc=130:300:60mm};
    \draw[thick] (-2,-14)  pic{carc=30:150:100mm};
    \draw[dashed] (-3,6)--(-3, -6);
    \draw[red] (-2.8,6)--(-2.8, -6);
    \draw[blue] (-2.2,6)--(-2.2, -6);
    \end{tikzpicture}
    \caption{Zoomed in}
    \label{fig:zoom}
\end{figure}

\end{document}

What can I do to scale the arcs as well?

7
  • 2
    Try \begin{tikzpicture}[scale=0.5, transform shape]
    – CarLaTeX
    Nov 19, 2017 at 17:32
  • @CarLaTeX that did the trick. Can you post this as an answer?
    – padawan
    Nov 19, 2017 at 17:36
  • I'll do it asap (I have no time at the moment) :)
    – CarLaTeX
    Nov 19, 2017 at 17:55
  • Could also use \scalebox{<scale>}{<tikz picture>} Nov 19, 2017 at 18:22
  • @aidangallagher4 what is the difference in theory?
    – padawan
    Nov 19, 2017 at 18:22

2 Answers 2

1

You can use transform shape, see Section 17.7 of the TikZ & PGF Manual (for Version 3.0.1a).

By the way, look also at this post: Should \tikzset or \tikzstyle be used to define TikZ styles?.

\documentclass[a4paper]{article}
\usepackage{tikz}
\tikzset{
    pics/carc/.style args={#1:#2:#3}{
        code={
            \draw[pic actions] (#1:#3) arc(#1:#2:#3);
        }
    }
}
\begin{document}
    \begin{figure}[htbp]
        \centering
        \begin{tikzpicture}[
            scale=0.5, 
            transform shape,
            disk/.style={draw, thick, circle, fill=none},
            center/.style={draw,shape=rectangle,fill=blue},
            intersection/.style={draw, circle, fill=darkgray, inner sep=0.8mm}
            ]
            \node at (-6,0) {$A$};
            \node at (1,0) {$B$};
            \node at (-2,-6) {$C$};
            \draw[thick] (-8,0) pic{carc=-100:50:60mm};
            \draw[thick] (2,0) pic{carc=130:300:60mm};
            \draw[thick,red] (3.2,0) pic{carc=130:300:60mm};
            \draw[thick] (-2,-14) pic{carc=30:150:100mm};
            \draw[dashed] (-3,6) -- (-3,-6);
            \draw[red] (-2.8,6) -- (-2.8,-6);
            \draw[blue] (-2.2,6) -- (-2.2,-6);
        \end{tikzpicture}
        \caption{Zoomed in\label{fig:zoom}}
    \end{figure}
\end{document}

enter image description here

Or, if you don't want to change the node text size, add it only to the draw with the pics:

\documentclass[a4paper]{article}
\usepackage{tikz}
\tikzset{
    pics/carc/.style args={#1:#2:#3}{
        code={
            \draw[pic actions] (#1:#3) arc(#1:#2:#3);
        }
    }
}
\begin{document}
    \begin{figure}[htbp]
        \centering
        \begin{tikzpicture}[
            scale=0.5, 
            disk/.style={draw, thick, circle, fill=none},
            center/.style={draw,shape=rectangle,fill=blue},
            intersection/.style={draw, circle, fill=darkgray, inner sep=0.8mm}
            ]
            \node at (-6,0) {$A$};
            \node at (1,0) {$B$};
            \node at (-2,-6) {$C$};
            \draw[thick,transform shape,
            ] (-8,0) pic{carc=-100:50:60mm};
            \draw[thick,transform shape] (2,0) pic{carc=130:300:60mm};
            \draw[thick,red,transform shape] (3.2,0) pic{carc=130:300:60mm};
            \draw[thick,transform shape] (-2,-14) pic{carc=30:150:100mm};
            \draw[dashed] (-3,6) -- (-3,-6);
            \draw[red] (-2.8,6) -- (-2.8,-6);
            \draw[blue] (-2.2,6) -- (-2.2,-6);
        \end{tikzpicture}
        \caption{Zoomed in\label{fig:zoom}}
    \end{figure}
\end{document}

enter image description here

0

The pic is not scaled correctly. You should separately scale=0.5 in the carc definition

  \documentclass[a4paper]{article}
\usepackage{tikz}
\tikzset{
    pics/carc/.style args={#1:#2:#3}{
        code={
            \draw[pic actions,scale=0.5] (#1:#3) arc(#1:#2:#3);
        }
    }
}
\begin{document}


    \begin{figure}[htbp]
        \centering
        \begin{tikzpicture}[scale=0.5]
        \tikzstyle{disk} = [draw, thick, circle,fill=none]
        \tikzstyle{center} = [draw,shape=rectangle,fill=blue]
        \tikzstyle{intersection} = [draw, circle ,fill=darkgray, inner sep=0.8mm]
        \node at (-6,0) {$A$};
        \node at (1,0) {$B$};
        \node at (-2,-6) {$C$};
        \draw[thick] (-8,0)  pic{carc=-100:50:60mm};
        \draw[thick] (2,0)  pic{carc=130:300:60mm};
        \draw[thick,red] (3.2,0)  pic{carc=130:300:60mm};
        \draw[thick] (-2,-14)  pic{carc=30:150:100mm};
        \draw[dashed] (-3,6)--(-3, -6);
        \draw[red] (-2.8,6)--(-2.8, -6);
        \draw[blue] (-2.2,6)--(-2.2, -6);
        \end{tikzpicture}
        \caption{Zoomed in}
        \label{fig:zoom}
    \end{figure}

\end{document}

enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .