A user asked a question about scaling a figure to a factor of \textwidth
and got an answer like this:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics[width=0.5\textwidth]{file}
\end{document}
however, I'm not sure how to apply this to my document:
\documentclass{article}
\usepackage{graphicx}
\usepackage{tikz}
\begin{document}
\begin{figure}[!h]
\centering
\begin{tikzpicture}
%
\end{tikzpicture}
\caption{This figure has a width which is a factor of \\textwidt}
\end{figure}
\end{document}
I've tried
\begin{figure}[!h, width=\textwidth]
but that didn't work.
Best Answer
You need
tikzscale
package. Save the contentsas
myfig.tikz
(say) and use\includegraphics
Code:
Unlike
\resizebox
, the fonts are not scaled in-appropriately. If you want to scale fonts too, use\begin{tikzpicture}[transform shape]
instead of\begin{tikzpicture}
.With
\resizebox
fromgraphicx
: