How to make font in subfigure of tikZ same size as document

  • LaTeX
  • Thread starter member 428835
  • Start date
  • Tags
    Font
In summary, the conversation is about a code in LateX that has pictures which are being scaled down along with the font. The speaker suggests creating a new environment to control the font size before the rescaling is done. This is seen as a good exercise for improving skills in LaTeX.
  • #1
member 428835
Hi PF!

I have the following code
Code:
\begin{figure}
    \isp
    \begin{subfigure}[t]{0.5\textwidth}
    \centering
    \resizebox{\linewidth}{!}{
    \begin{tikzpicture}
\draw(0,0) to (0,1);
\node at (0,1) {$z$};
\end{tikzpicture}
    }
    \caption{}
      \label{tri}
    \end{subfigure}
    \begin{subfigure}[t]{0.5\textwidth}
       \centering
        \resizebox{\linewidth}{!}{
      \begin{tikzpicture}
\draw(0,0) to (1,0);
\node at (1,0) {$x$};
     \end{tikzpicture}
   }
   \caption{}
      \label{round}
    \end{subfigure}
        \caption{Illustration of the tapered corner regime.}
        \label{tc}
\end{figure}

in LateX but for some reason when I scale the pictures, the font is also scaled. How can I control this so the font is the same size as the rest of the document?

Thanks so much!

Josh
 
Physics news on Phys.org
  • #2
It's quite logical behaviour that the font is scaled down.
First the contents of the resizebox etc. are rendered after which they are scaled down hence the smaller font.

I would approach this by defining a new environment.
This environment would take a scaling parameter and perhaps a reference length.

In this environment you would scale up the fontsize before the rescaling is done.
This is a great exercise to become better at LaTeX.
 

FAQ: How to make font in subfigure of tikZ same size as document

How do I adjust the font size in a subfigure of tikZ to match the document?

To adjust the font size in a subfigure of tikZ to match the document, you can use the \fontsize command in the tikZ code. This command takes two arguments - the first one specifies the font size and the second one specifies the line spacing. You can experiment with different font sizes until you find the one that matches the document.

Can I use a specific font for the subfigure in tikZ?

Yes, you can specify a specific font for the subfigure in tikZ by using the \fontfamily command in the tikZ code. This command takes one argument - the name of the font you want to use. Make sure to include the necessary packages for the font to be recognized.

How do I change the font color in a subfigure of tikZ?

To change the font color in a subfigure of tikZ, you can use the \color command in the tikZ code. This command takes one argument - the name of the color you want to use. You can also specify the RGB values for a custom color.

Is it possible to make the font in a subfigure of tikZ bold or italic?

Yes, you can make the font in a subfigure of tikZ bold or italic by using the \textbf and \textit commands in the tikZ code. These commands take one argument - the text you want to format. You can also use the \emph command to emphasize text.

Can I adjust the font size for individual elements within a subfigure in tikZ?

Yes, you can adjust the font size for individual elements within a subfigure in tikZ by using the \fontsize command directly before the element you want to change the font size for. This will only affect that specific element and not the rest of the subfigure.

Similar threads

Replies
5
Views
2K
Replies
2
Views
1K
Replies
1
Views
5K
Replies
1
Views
1K
Replies
2
Views
5K
Replies
3
Views
4K
Replies
4
Views
2K
Back
Top