2

I have exported a diagram created with Dia to LaTeX PGF macro (.tex) and now I want to include it. I have found the code below. It works great but the framebox creates border around my image which I don't want.

How can I scale it to text width without a border around the image?

\documentclass[a4paper,10pt]{article}
\usepackage{tikz}
\title{\textbf{\LaTeXe font-consistent diagrams using Dia}}
\author{Munthu}
\date{}
\begin{document}
\maketitle
\section{A minimal example}
You will notice that the fonts used in Figure \ref{fig:latex_dia_integration} are consistent with the document.
\begin{figure}[hb]
\begin{center}
\framebox[0.90\textwidth]{%
\input{dia_latex_block_diagrams.tex}
}
\end{center}
\caption[]{\label{fig:latex_dia_integration} A sample font-consistent figure
}
\end{figure}
\end{document}
  • Just omit \framebox[...]{...}. And instead \begin{center} ... \end{center} use only \centering after \begin{figure}[htb]. – Zarko Jul 17 '16 at 21:41
  • \resizebox{.9\textwidth}{!}{\input{dia_latex_block_diagrams}}? – cfr Jul 17 '16 at 22:21
  • @Zarko How will that scale anything? – cfr Jul 17 '16 at 22:25
  • @cfr, \framebox doesn't scale anything (as far as I know). If OP doesn't like to have frame around image, than it not to be used. For scaling (without to see picture) is one way as you suggest in your answer. However, I prefer to draw picture so, that it can be used without any scaling. – Zarko Jul 17 '16 at 22:38
  • @Zarko OK. Thanks. I never use \framebox. So the OP thinks they need scaling, but really they don't ;). – cfr Jul 17 '16 at 23:15
4

You can use \resizebox from the graphicx package.

\begin{figure}[hb]
  \centering
  \resizebox{.9\textwidth}{!}{\input{dia_latex_block_diagrams}}
  \caption[]{\label{fig:latex_dia_integration} A sample font-consistent figure}
\end{figure}

Obviously this is untested as your example cannot be compiled.

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.