6

I am looking for a solution to exclude some TikZ commands from the scale influence. The scale option consolidates the tikzpicture and scales it as a whole, I am looking for a way to remove certain commands from that consolidation.

An example of this is the the right angle box. I tend to draw a lot of figures containing the Right angle mark, and I need it to keep its constant dimensions regardless of the scale, because in scale down case it almost disappears . I know that can be done using scopes, but In my case that is not feasible because I am using a script in a different program to scale the TikZ drawing as a whole.

So to put it simply, I am wondering is there is any type of environment that can exclude certain TikZ commands for the generic scale option.

    \documentclass[tikz,border=12pt]{standalone}
    \usepackage{stix, tikz, tkz-euclide}
    \usetikzlibrary{angles, calc, quotes, arrows, arrows.meta}
    \usetkzobj{all}
    \begin{document}
    %% The scale command
    \begin{tikzpicture}[scale=0.3]
    \begin{scope}[thick, >={Stealth[scale=1.2]}]
    \coordinate[label=below left:\textcolor{red}{$O$}] (o) at (0,0);

    \coordinate (a) at (4,0);
    \coordinate [label=below :\textcolor{red}{$A$}](aa) at ({0.87*4},0);
    \coordinate (c) at (0,4);
    \coordinate [label= left:\textcolor{red}{$C$}](cc) at (0,{0.87*4});

    \path (o)--(58:4) coordinate (b);
    \coordinate [label=above left:\textcolor{red}{$B$}](bb) at (58:{0.87*4});
    %% The Right angel command
    \tkzMarkRightAngle[size=0.4,opacity=1,color=red](a,o,c);

    \path [decorate, decoration={markings, mark=at position 0.87 with {\draw[thick] (0pt,-2pt)--(0pt,2pt);}}] (o)--(a);
    \path [decorate, decoration={markings, mark=at position 0.87 with {\draw[thick] (0pt,-2pt)--(0pt,2pt);}}] (o)--(b);
    \path [decorate, decoration={markings, mark=at position 0.87 with {\draw[thick] (0pt,-2pt)--(0pt,2pt);}}] (o)--(c);

    \draw[<->] (a)--(o)--(c);
    \draw[->] (o)--(b);
    \end{scope}
    \end{tikzpicture}

    \end{document}

In the above drawing, the scale is 0.3. sometimes I draw geometric constructions with actual dimensions and I scale them down afterwards.

3

An idea. Inside your drawing you can recover the scale factor which is in use (as was shown in Access the scale option within TikZ environment) and use that value to adjust the size of the mark, so that it is "scaled up" again in the same factor, so that it remains of the same apparent size.

For example:

\documentclass[tikz,border=12pt]{standalone}
\usepackage{stix, tikz, tkz-euclide}
\usetikzlibrary{angles, calc, quotes, arrows, arrows.meta}
\usetkzobj{all}
\begin{document}
%% The scale command
\begin{tikzpicture}[scale=1.0]
\begin{scope}[thick, >={Stealth[scale=1.2]}]
\coordinate[label=below left:\textcolor{red}{$O$}] (o) at (0,0);

\coordinate (a) at (4,0);
\coordinate [label=below :\textcolor{red}{$A$}](aa) at ({0.87*4},0);
\coordinate (c) at (0,4);
\coordinate [label= left:\textcolor{red}{$C$}](cc) at (0,{0.87*4});

\path (o)--(58:4) coordinate (b);
\coordinate [label=above left:\textcolor{red}{$B$}](bb) at (58:{0.87*4});
%% The Right angel command
\pgfgettransformentries{\mya}{\myb}{\myc}{\myd}{\mys}{\myt}
\pgfmathsetmacro{\grow}{1/\mya}
\tkzMarkRightAngle[size=0.4*\grow, opacity=1,color=red](a,o,c);

\path [decorate, decoration={markings, mark=at position 0.87 with {\draw[thick] (0pt,-2pt)--(0pt,2pt);}}] (o)--(a);
\path [decorate, decoration={markings, mark=at position 0.87 with {\draw[thick] (0pt,-2pt)--(0pt,2pt);}}] (o)--(b);
\path [decorate, decoration={markings, mark=at position 0.87 with {\draw[thick] (0pt,-2pt)--(0pt,2pt);}}] (o)--(c);

\draw[<->] (a)--(o)--(c);
\draw[->] (o)--(b);
\end{scope}
\end{tikzpicture}
\end{document}

Compare the result when the outer scale is 1, 0.6 and 0.3 respectively:

Scale 1.0 Scale 0.6 Scale 0.3

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.