Graphics, Figures & TablesResize PGF image (but not text)

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
stinkinrich88
Posts: 52
Joined: Sat Jun 07, 2008 11:56 am

Resize PGF image (but not text)

Post by stinkinrich88 »

Hello,

How can I resize a pgf image, but keep the text in the image the same size?

I can't use \resizebox because this also resizes the text.

I understand that I can use the following in my pgf file:

Code: Select all

\begin{tikzpicture}[scale=2]
However, that scales the image, rather than letting me resize it to a specific width. So this is also no good.

Thank you!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

johnjamessmith0
Posts: 37
Joined: Sun Mar 29, 2009 1:41 am

Resize PGF image (but not text)

Post by johnjamessmith0 »

Since no one has posted anything, I will present my woefully ugly and inadequate semi-solution (I had the same problem when doing a project some time ago) defining a bounding box a manually calculating the scale factor. The following produces a picture that is four inches wide.

Code: Select all

\newcommand{\cmsperinch}{2.54}
\begin{tikzpicture}[scale=\cmsperinch*4/3]

\path[use as bounding box, draw] (2,2) rectangle (5,7);
\draw (3,3) -- (4.5,6);

\end{tikzpicture}
Of course, this means you'll have to explicitly find the coordinate boundaries of the picture yourself. Perhaps someone cleverer can come up with a solution involving current bounding boxes and scopes and at-end-picture commands or something.
Post Reply