0

Normally I scale the font size of latex + pdf pictures with the \def\svgwidth command which works really nice.

\begin{figure}[htbp]
\begin{center}
\def\svgwidth{1in}
\resizebox{!}{.7\textwidth}{\input{test.tex}}
    \caption{aaa.}
    \label{fig:aaa}
    \end{center}
\end{figure}

But for the attached pdf+tex file the \def\svgwidth does not work at all.

The font size remains unchanged under changes of svgwidth. The pdf size, made with gnuplot, is chosen to 32x24cm.

Any suggestions on that?

Tex-file: Tex Pdf-file: Pdf

% GNUPLOT: LaTeX picture with Postscript
\begingroup
  \makeatletter
  \providecommand\color[2][]{%
    \GenericError{(gnuplot) \space\space\space\@spaces}{%
      Package color not loaded in conjunction with
      terminal option `colourtext'%
    }{See the gnuplot documentation for explanation.%
    }{Either use 'blacktext' in gnuplot or load the package
      color.sty in LaTeX.}%
    \renewcommand\color[2][]{}%
  }%
  \providecommand\includegraphics[2][]{%
    \GenericError{(gnuplot) \space\space\space\@spaces}{%
      Package graphicx or graphics not loaded%
    }{See the gnuplot documentation for explanation.%
    }{The gnuplot epslatex terminal needs graphicx.sty or graphics.sty.}%
    \renewcommand\includegraphics[2][]{}%
  }%
  \providecommand\rotatebox[2]{#2}%
  \@ifundefined{ifGPcolor}{%
    \newif\ifGPcolor
    \GPcolortrue
  }{}%
  \@ifundefined{ifGPblacktext}{%
    \newif\ifGPblacktext
    \GPblacktexttrue
  }{}%
  % define a \g@addto@macro without @ in the name:
  \let\gplgaddtomacro\g@addto@macro
  % define empty templates for all commands taking text:
  \gdef\gplbacktext{}%
  \gdef\gplfronttext{}%
  \makeatother
  \ifGPblacktext
    % no textcolor at all
    \def\colorrgb#1{}%
    \def\colorgray#1{}%
  \else
    % gray or color?
    \ifGPcolor
      \def\colorrgb#1{\color[rgb]{#1}}%
      \def\colorgray#1{\color[gray]{#1}}%
      \expandafter\def\csname LTw\endcsname{\color{white}}%
      \expandafter\def\csname LTb\endcsname{\color{black}}%
      \expandafter\def\csname LTa\endcsname{\color{black}}%
      \expandafter\def\csname LT0\endcsname{\color[rgb]{1,0,0}}%
      \expandafter\def\csname LT1\endcsname{\color[rgb]{0,1,0}}%
      \expandafter\def\csname LT2\endcsname{\color[rgb]{0,0,1}}%
      \expandafter\def\csname LT3\endcsname{\color[rgb]{1,0,1}}%
      \expandafter\def\csname LT4\endcsname{\color[rgb]{0,1,1}}%
      \expandafter\def\csname LT5\endcsname{\color[rgb]{1,1,0}}%
      \expandafter\def\csname LT6\endcsname{\color[rgb]{0,0,0}}%
      \expandafter\def\csname LT7\endcsname{\color[rgb]{1,0.3,0}}%
      \expandafter\def\csname LT8\endcsname{\color[rgb]{0.5,0.5,0.5}}%
    \else
      % gray
      \def\colorrgb#1{\color{black}}%
      \def\colorgray#1{\color[gray]{#1}}%
      \expandafter\def\csname LTw\endcsname{\color{white}}%
      \expandafter\def\csname LTb\endcsname{\color{black}}%
      \expandafter\def\csname LTa\endcsname{\color{black}}%
      \expandafter\def\csname LT0\endcsname{\color{black}}%
      \expandafter\def\csname LT1\endcsname{\color{black}}%
      \expandafter\def\csname LT2\endcsname{\color{black}}%
      \expandafter\def\csname LT3\endcsname{\color{black}}%
      \expandafter\def\csname LT4\endcsname{\color{black}}%
      \expandafter\def\csname LT5\endcsname{\color{black}}%
      \expandafter\def\csname LT6\endcsname{\color{black}}%
      \expandafter\def\csname LT7\endcsname{\color{black}}%
      \expandafter\def\csname LT8\endcsname{\color{black}}%
    \fi
  \fi
    \setlength{\unitlength}{0.0500bp}%
    \ifx\gptboxheight\undefined%
      \newlength{\gptboxheight}%
      \newlength{\gptboxwidth}%
      \newsavebox{\gptboxtext}%
    \fi%
    \setlength{\fboxrule}{0.5pt}%
    \setlength{\fboxsep}{1pt}%
\begin{picture}(18140.00,13600.00)%
    \gplgaddtomacro\gplbacktext{%
      \csname LTb\endcsname%
      \put(459,372){\makebox(0,0)[r]{\strut{}$-10$}}%
      \csname LTb\endcsname%
      \put(459,3628){\makebox(0,0)[r]{\strut{}$-5$}}%
      \csname LTb\endcsname%
      \put(459,6884){\makebox(0,0)[r]{\strut{}$0$}}%
      \csname LTb\endcsname%
      \put(459,10139){\makebox(0,0)[r]{\strut{}$5$}}%
      \csname LTb\endcsname%
      \put(459,13395){\makebox(0,0)[r]{\strut{}$10$}}%
      \csname LTb\endcsname%
      \put(561,186){\makebox(0,0){\strut{}$-10$}}%
      \csname LTb\endcsname%
      \put(4879,186){\makebox(0,0){\strut{}$-5$}}%
      \csname LTb\endcsname%
      \put(9197,186){\makebox(0,0){\strut{}$0$}}%
      \csname LTb\endcsname%
      \put(13515,186){\makebox(0,0){\strut{}$5$}}%
      \csname LTb\endcsname%
      \put(17833,186){\makebox(0,0){\strut{}$10$}}%
    }%
    \gplgaddtomacro\gplfronttext{%
      \csname LTb\endcsname%
      \put(8384,9426){\makebox(0,0)[r]{\strut{}abc}}%
    }%
    \gplbacktext
    \put(0,0){\includegraphics{test}}%
    \gplfronttext
  \end{picture}%
\endgroup
  • the scaling and \svgwidth are unrelated to the figure or sidewaysfigure that surrounds them. it is rather odd to use \paperheight in either case as that relates to the physical page not the text block. try using say {.75\linewidth}{!} in both cases to make the image three quarters of the width at that point. – David Carlisle Oct 4 '17 at 21:40
  • @David Carlisle : I want to scale the font size, and not the size of the figure which is fine. Paperheight can be useful, if I have more than one figure (e.g. 2 figures in 2 minipages). In all my other figures, \def\svgwidth works. Could the pdf size be an issue? I chose a size of 32x24cm. – cerv21 Oct 4 '17 at 21:59
  • you haven't given any example anyone can run but \resizebox scales all its contents text or lines so I can not guess what you mean by not scaling the contents, but the scaling is completely unrelated to the figure. As you can easily test yourself \def\svgwidth{2.0in} \resizebox{!}{0.5\paperheight}{\input{latexpics/b.tex}} will be the same size whether it is just directly in the document or if it is in a figure or sideways figure. – David Carlisle Oct 4 '17 at 22:04
  • if you have two figures in two minipages they should be half \textheight or half \textwidth depending how you stack them, there are almost no cases where you would want to base the size on \paperheight – David Carlisle Oct 4 '17 at 22:06
  • how can I upload a pdf and a tex file? – cerv21 Oct 4 '17 at 22:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.