Graphics, Figures & TablesPDF figures with standalone class

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
rascarcapac
Posts: 3
Joined: Wed Apr 30, 2014 5:19 pm

PDF figures with standalone class

Post by rascarcapac »

Hello everyone,

This is my very first post on the LaTeX community. I apologise in advance for any forum rule or language error.
I use PDF LaTeX and inkscape and Matlab for most of my figures, having set up the typical pdf+pdf_tex option from inkscape to have quality and flexibility.
I really love this system and I want to stick with it. However I have recently submitted an article to an elsevier journal and the pdf+pdf_tex combo was not a good option :-(. Also sometimes I want to send an individual figure and I can't because the text and the background image are separated.
As a workaround I am now trying to produce individual PDF files that have the background image and the text included. I was able to partially achieve this by isolating the figure and using the standalone class.

Code: Select all

\documentclass[12pt]{standalone}
%Other necessary packages/commands ...
\begin{document}
\def\svgwidth{0.8\textwidth}
\includesvg{figure1}
\end{document}
The problem is that the text gets cropped at the background borders (see attached figure).
figure_1.pdf
figure with text cropped
(42.25 KiB) Downloaded 361 times
I have searched the standalone document class documentation but I was unable to find a solution.

Thanks in advance for any help or advise.

Best regards
Anders

Recommended reading 2024:

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

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

rascarcapac
Posts: 3
Joined: Wed Apr 30, 2014 5:19 pm

PDF figures with standalone class

Post by rascarcapac »

Oh sorry. I forgot to include my MWE. Here are the tex, pdf and pdf_tex files (I can't post the pdf_tex therefore I will write the code below). This should generate the file in the attachment given on my previous post. Please help me

Code: Select all

%% Creator: Inkscape inkscape 0.48.4, www.inkscape.org
%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010
%% Accompanies image file 'viaduct_general.pdf' (pdf, eps, ps)
%%
%% To include the image in your LaTeX document, write
%%   \input{<filename>.pdf_tex}
%%  instead of
%%   \includegraphics{<filename>.pdf}
%% To scale the image, write
%%   \def\svgwidth{<desired width>}
%%   \input{<filename>.pdf_tex}
%%  instead of
%%   \includegraphics[width=<desired width>]{<filename>.pdf}
%%
%% Images with a different path to the parent latex file can
%% be accessed with the `import' package (which may need to be
%% installed) using
%%   \usepackage{import}
%% in the preamble, and then including the image with
%%   \import{<path to file>}{<filename>.pdf_tex}
%% Alternatively, one can specify
%%   \graphicspath{{<path to file>/}}
%% 
%% For more information, please see info/svg-inkscape on CTAN:
%%   http://tug.ctan.org/tex-archive/info/svg-inkscape
%%
\begingroup%
  \makeatletter%
  \providecommand\color[2][]{%
    \errmessage{(Inkscape) Color is used for the text in Inkscape, but the package 'color.sty' is not loaded}%
    \renewcommand\color[2][]{}%
  }%
  \providecommand\transparent[1]{%
    \errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package 'transparent.sty' is not loaded}%
    \renewcommand\transparent[1]{}%
  }%
  \providecommand\rotatebox[2]{#2}%
  \ifx\svgwidth\undefined%
    \setlength{\unitlength}{126.72344bp}%
    \ifx\svgscale\undefined%
      \relax%
    \else%
      \setlength{\unitlength}{\unitlength * \real{\svgscale}}%
    \fi%
  \else%
    \setlength{\unitlength}{\svgwidth}%
  \fi%
  \global\let\svgwidth\undefined%
  \global\let\svgscale\undefined%
  \makeatother%
  \begin{picture}(1,0.75781922)%
    \put(0,0){\includegraphics[width=\unitlength]{viaduct_general.pdf}}%
    \put(0.14436301,0.4419072){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$P_1$}}}%
    \put(0.1893888,0.4419072){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$P_2$}}}%
    \put(0.22726656,0.4419072){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$P_3$}}}%
    \put(0.77649407,0.4419072){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$P_{46}$}}}%
    \put(0.02592821,0.21437554){\color[rgb]{0,0,0}\rotatebox{90}{\makebox(0,0)[lb]{\smash{33~m}}}}%
    \put(0.4423663,0.03364163){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{1312~m}}}%
    \put(0.75852541,0.30823959){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Alluvium}}}%
    \put(0.53660159,0.13906891){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Miocene}}}%
    \put(0.86458682,0.24252012){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Pleistocene}}}%
    \put(0.82068479,0.35352576){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Emb.}}}%
    \put(0.08206848,0.35983872){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Emb.}}}%
    \put(0.82068479,0.20832768){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{ and Miocene}}}%
    \put(0.14519808,0.57447935){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{AD}}}%
    \put(0.72599039,0.57447935){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{DD}}}%
  \end{picture}%
\endgroup%
Attachments
viaduct_general.pdf
(19.83 KiB) Downloaded 229 times
figure_1.tex
(578 Bytes) Downloaded 328 times
rascarcapac
Posts: 3
Joined: Wed Apr 30, 2014 5:19 pm

Re: PDF figures with standalone class

Post by rascarcapac »

No help, huh? Well, thanks anyway. I shall figure it out by myself somehow.
Post Reply