6

I'm using a scalebox around a picture. There's text inside it. I'd like the text size to keep constant even if I change the scale factor.

\scalebox{0.5}{
  \begin{picture}(360,255)(0,0)%
  \put(0,0){\includegraphics{figures/basic_flow1.pdf}}
  \put(80,180){$\phi_Q$}
  \end{picture}
}

What's the best way to do this? I know that shrinking 24 pt to 12pt doesn't produce an exact copy of the usual 12pt. So just using a larger font isn't necesarily a good option.

1
  • 5
    Why are you using \scalebox in the first place? You could adjust the units instead, and also use the scale key-value for \includegraphics.
    – Werner
    Jan 7, 2015 at 6:22

2 Answers 2

4

So here's the solution:

\scalebox{0.5}{
  \begin{picture}(360,255)(0,0)%
  \put(0,0){\includegraphics{figures/basic_flow1.pdf}}
  \put(80,180){\scalebox{2}{$\phi_Q$}}
  \end{picture}
}

Just put a new scalebox around the text to undo the scaling.

3

You can avoid setting the picture width by eye; just the placement of the text needs some trials.

\documentclass{article}
\usepackage{pict2e,picture}
\usepackage{graphicx}

\newsavebox{\tempbox}

\begin{document}

\begin{figure}
\centering

\sbox{\tempbox}{\includegraphics[width=\textwidth]{example-image.pdf}}
\setlength{\unitlength}{1pt}% just to be sure
\begin{picture}(\wd\tempbox,\ht\tempbox)
\put(0,0){\usebox{\tempbox}}
\put(80,180){$\phi_Q$}
\end{picture}

\caption{A scaled figure, with unscaled text}

\end{figure}

\end{document}

enter image description here

7
  • I wanted to avoid setting the width (for what it's worth \columnwidth is a somewhat safer choice). In this case, I have several figures, all with the same original size for boxes within the figures, but different widths. Using a uniform figure width would cause different box sizes between the figures. I suppose I could have just put the scalebox around the includegraphics...
    – Joel
    Jan 8, 2015 at 23:23
  • @Joel You don't want \scalebox.
    – egreg
    Jan 8, 2015 at 23:29
  • 1
    Can you suggest an alternative? Is there another option besides scalebox that scales by a given amount? If I have on figure that is 5cm, another that is 6cm and I set their width to be the same, then the figures will be inconsistent - a circle in one figure meaning the same thing as a circle in the other figure will have different sizes. Better to scale both by the same amount.
    – Joel
    Jan 9, 2015 at 0:15
  • @Joel If you want the width to be the same set the width as I did.
    – egreg
    Jan 9, 2015 at 0:15
  • But if I make the width the same, the figures will not have consistent appearance.
    – Joel
    Jan 9, 2015 at 0:16

You must log in to answer this question.

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