From 50936fcbf8d7c6fafc2b9e43b2b9ca4715d954f2 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 22 Nov 2013 00:02:23 +0000 Subject: svg-inkscape (21nov13) git-svn-id: svn://tug.org/texlive/trunk@32199 c570f23f-e606-0410-a88d-b1316a301751 --- .../doc/latex/svg-inkscape/InkscapePDFLaTeX.pdf | Bin 204793 -> 219776 bytes .../doc/latex/svg-inkscape/InkscapePDFLaTeX.tex | 74 +++++++++++++++------ Master/texmf-dist/doc/latex/svg-inkscape/README | 14 +++- .../doc/latex/svg-inkscape/image-normal.pdf | Bin 69630 -> 82902 bytes Master/texmf-dist/doc/latex/svg-inkscape/image.pdf | Bin 6641 -> 6639 bytes .../doc/latex/svg-inkscape/image.pdf_tex | 13 +++- Master/texmf-dist/doc/latex/svg-inkscape/image.svg | 22 +++--- 7 files changed, 87 insertions(+), 36 deletions(-) diff --git a/Master/texmf-dist/doc/latex/svg-inkscape/InkscapePDFLaTeX.pdf b/Master/texmf-dist/doc/latex/svg-inkscape/InkscapePDFLaTeX.pdf index ac3eebcc9c7..3f38be1130d 100644 Binary files a/Master/texmf-dist/doc/latex/svg-inkscape/InkscapePDFLaTeX.pdf and b/Master/texmf-dist/doc/latex/svg-inkscape/InkscapePDFLaTeX.pdf differ diff --git a/Master/texmf-dist/doc/latex/svg-inkscape/InkscapePDFLaTeX.tex b/Master/texmf-dist/doc/latex/svg-inkscape/InkscapePDFLaTeX.tex index ccfe8cfdc45..ac4555c7bc0 100644 --- a/Master/texmf-dist/doc/latex/svg-inkscape/InkscapePDFLaTeX.tex +++ b/Master/texmf-dist/doc/latex/svg-inkscape/InkscapePDFLaTeX.tex @@ -18,8 +18,11 @@ \usepackage{url} \usepackage[protrusion=true,expansion=true]{microtype} -\usepackage[T1]{fontenc} -\usepackage[adobe-utopia]{mathdesign} +%\usepackage[T1]{fontenc} +%\usepackage[adobe-utopia]{mathdesign} +\usepackage{fourier} + +\usepackage{calc} \usepackage{verbatim} \makeatletter @@ -43,9 +46,8 @@ \title{How to include an SVG image in \LaTeX} -\author{Johan B. C. Engelen\corref{corauth}} -\cortext[corauth]{Corresponding author: \href{mailto:j.b.c.engelen@utwente.nl}{j.b.c.engelen@utwente.nl}} -\address{MESA$^+$ and IMPACT Research Institutes, TST group, University of Twente, Enschede, the Netherlands} +\author{Johan B. C. Engelen} +\address{\href{mailto:j.b.c.engelen@alumnus.utwente.nl}{j.b.c.engelen@alumnus.utwente.nl}} \journal{\hspace{-10em}XXXXXXXXXXXXXXXX} @@ -53,7 +55,7 @@ How to make a \LaTeX\ document with vector images, where the text in the images has exactly the same font and size as in normal text? This article describes how this is done using the `PDF/EPS/PS + LaTeX' output feature of Inkscape 0.48. Inkscape can export the graphics to PDF/EPS/PS, and the text to a \LaTeX\ file. When the \LaTeX\ file is input in the \LaTeX\ document, the PDF/EPS/PS image is included with overlaid text. Because typesetting of the text is done by \LaTeX, \LaTeX\ commands can be used in images, such as writing equations, references and shorthand macros.\\ -\emph{(requires Inkscape version 0.48 or higher)} +\emph{(requires Inkscape version 0.48 or higher; this document discusses features up to Inkscape 0.49)} \end{abstract} % %\begin{keyword} @@ -67,7 +69,7 @@ Because typesetting of the text is done by \LaTeX, \LaTeX\ commands can be used \centering \executeiffilenewer{image.svg}{image-normal.pdf}{inkscape -z -D --file=image.svg --export-pdf=image-normal.pdf} \includegraphics[width=\columnwidth]{image-normal.pdf} - \caption{The test SVG image, as it is seen in Inkscape (exported to PDF \emph{without} LaTeX option).} + \caption{The test SVG image, as it is seen in Inkscape (exported to PDF \emph{without} \LaTeX\ option).} \label{fig:normal} \end{figure} @@ -75,7 +77,7 @@ Because typesetting of the text is done by \LaTeX, \LaTeX\ commands can be used \centering \def\svgwidth{\columnwidth} \includesvg{image} - \caption{The test image, exported to PDF \emph{with} LaTeX option.} + \caption{The test image, exported to PDF \emph{with} \LaTeX\ option.} \label{fig:pdflatex} \end{figure} @@ -85,7 +87,7 @@ An advantage of `drawing' images in \LaTeX\ code using e.g. TikZ, is the more un Inspired by the `epslatex' GNUPlot output terminal, a new feature was added to Inkscape, combining the advantages of \LaTeX\ text typesetting and drawing in Inkscape. This article describes how to use Inkscape to create images in which the text font is equal to the document's font, \LaTeX\ mathematical expressions can be written, and \LaTeX\ commands can be used. The automated inclusion of SVG graphics while using the new `PDF+LaTeX' Inkscape option is described. -\emph{(This article assumes the use of PDFLaTeX, but most will probably work just as well for EPS/PS documents.)} +\emph{(This article assumes the use of pdf\LaTeX\, but most will probably work just as well for EPS/PS documents.)} \section{Creating the image with Inkscape} @@ -101,6 +103,10 @@ I have tried to get the positioning of text in the end result as close as possib \subsection{Text colour} Text colouring works. If the text has a fill colour, this colour will be exported to \LaTeX\ as an RGB colour. Although stroking text will not work in \LaTeX, when the text as a stroke colour \emph{and no fill colour}, the stroke colour will be exported to \LaTeX\ as an RGB colour as if the text had that colour as fill. Text transparency is exported too.\footnote{Transparency is not exported when exporting to EPS or PS, because it is not supported by those formats.} +\subsection{Font shape (added in Inkscape 0.49)} + Italic, oblique and bold text in Inkscape is exported to \LaTeX\ in a clause with {\small\verb|\textit{}|}, {\small\verb|\textsl{}|} or {\small\verb|\textbf{}|}, respectively. +Note that Arial has an oblique shape in Inkscape, instead of italic. This means that the \LaTeX\ file will contain {\small\verb|\textsl{}|}, and the result is a slanted font shape. If you want italics in your \LaTeX\ output, you should use a font that has italics in Inkscape (e.g. Times). + \subsection{Exporting to PDF} When the image is saved to PDF, one has to set the `PDF+LaTeX' option in the dialog that pops up after specifying which file name to save to. The bounding box of the image in Inkscape \emph{including text} will be used as the bounding box for the image if the exported area is the drawing ({\small\verb|--export-area-drawing|}). It is strongly recommended to use this `exported area is drawing' option, because text will not be clipped to the page size. @@ -111,9 +117,9 @@ Exporting to PDF and \LaTeX\ can also be performed through the command line inte {\small\ttfamily{inkscape -D -z --{}--file=image.svg --{}--export-pdf=image.pdf --{}--export-latex}}. Note the added {\small\verb|--export-latex|} option. -\section{Including the image in LaTeX} +\section{Including the image in \LaTeX} -The image should be included in the document by inputting the {\small\verb|.pdf_tex|} file created by Inkscape. It is possible to set the width of the image by defining {\small\verb|\svgwidth|}: +The image should be included in the document by inputting the {\small\verb|.pdf_tex|} file created by Inkscape: \begin{verbatim} \begin{figure} \centering @@ -122,7 +128,30 @@ The image should be included in the document by inputting the {\small\verb|.pdf_ \end{figure} \end{verbatim} -The {\small\verb|.pdf_tex|} file created by Inkscape contains a {\small\verb|picture|} environment, that includes the PDF exported by Inkscape and places text on top of it. The result is figure~\ref{fig:pdflatex}, note that the font exactly matches the document's font, and the link to the equation works. If no width is specified, the image will have its original width. The {\small\verb|\svgwidth|} is forgotten after including a figure, so one must redefine the width for each figure ({\small\verb|\svgwidth|} is set empty by {\small\verb|image.pdf_tex|}). +The {\small\verb|.pdf_tex|} file created by Inkscape contains a {\small\verb|picture|} environment, that includes the PDF exported by Inkscape and places text on top of it. The result is figure~\ref{fig:pdflatex}, note that the font exactly matches the document's font, and the link to the equation works. + +\subsection{Scaling the image} +It is possible to set the width of the image by defining {\small\verb|\svgwidth|} before the {\small\verb|\input|} command: +\begin{verbatim} +\begin{figure} + \centering + \def\svgwidth{\columnwidth} + \input{image.pdf_tex} +\end{figure} +\end{verbatim} + +One can also scale the image, by including the {\small\verb|calc|} package in the preamble and defining {\small\verb|\svgscale|} accordingly (\emph{added in Inkscape 0.48.2}): +\begin{verbatim} +\usepackage{calc} +... +\begin{figure} + \centering + \def\svgscale{1.5} + \input{image.pdf_tex} +\end{figure} +\end{verbatim} + +Both {\small\verb|\svgwidth|} and {\small\verb|\svgscale|} are undefined (`forgotten') after including a figure ({\small\verb|\svgwidth|} and {\small\verb|\svgscale|} are set empty by {\small\verb|image.pdf_tex|}). \subsection{When images are not in the document's directory} When images are not located in the document's directory, but in a sub-directory, one has to add that directory to the graphics search path (unfortunately). For example, if one's images are in sub-directory {\small\verb|images|}, add the following to the preamble: @@ -148,10 +177,10 @@ Whenever the SVG file is updated, it is possible to have \LaTeX\ automatically c \begin{itemize} \item Modify the SVG image in Inkscape; \item Save the SVG (Ctrl+S, no need to export to PDF); - \item Recompile \LaTeX\ document. PDFLaTeX will notice the SVG file has changed, and will automatically do the export for you. + \item Recompile \LaTeX\ document. pdf\LaTeX\ will notice the SVG file has changed, and will automatically do the export for you. \end{itemize} -\subsubsection{LaTeX code} +\subsubsection{\LaTeX\ code} Add the following code to the preamble of your document: \begin{verbatim} \newcommand{\executeiffilenewer}[3]{% @@ -167,7 +196,7 @@ Add the following code to the preamble of your document: } \end{verbatim} -When an image is included via {\small\verb|\includesvg|}, it is automatically exported to PDF+\LaTeX\ again by Inkscape when the SVG file has changed (note that the image must be specified \emph{without} file extension): +When an image is included via {\small\verb|\includesvg|}, it is automatically exported to PDF+LaTeX again by Inkscape when the SVG file has changed (note that the image must be specified \emph{without} file extension): \begin{verbatim} \begin{figure} \centering @@ -178,6 +207,7 @@ When an image is included via {\small\verb|\includesvg|}, it is automatically ex The preamble code will only work if Inkscape is in the search path of your operating system (Windows: \url{http://www.computerhope.com/issues/ch000549.htm}). + \section{Example of using another font} \fontfamily{phv}\selectfont \renewcommand{\rmdefault}{phv}\rmfamily @@ -188,22 +218,24 @@ This is shown in figure~\ref{fig:otherfont}, where the same image file is includ \centering \def\svgwidth{\columnwidth} \includesvg{image} - \caption{The test image, exported to PDF \emph{with} LaTeX option. Note that the image's font matches the newly chosen font. The included \LaTeX\ file is the same as in figure~\ref{fig:pdflatex}.} + \caption{The test image, exported to PDF \emph{with} \LaTeX\ option. Note that the image's font matches the newly chosen font. The included \LaTeX\ file is the same as in figure~\ref{fig:pdflatex}.} \label{fig:otherfont} \end{figure} % switch back to Utopia -\fontfamily{mdput}\selectfont -\renewcommand{\rmdefault}{mdput}\rmfamily +\fontfamily{put}\selectfont +\renewcommand{\rmdefault}{put}\rmfamily \section{Known bugs and limitations} +It is advisable to use the latest Inkscape release, as additional features may have been added and bugs are continuously found and fixed. Please report any bug you find on \url{https://bugs.launchpad.net/inkscape}. -There are some known limitations/bugs. +There are still some known limitations/bugs. \begin{itemize} - \item Exporting to EPS+\LaTeX{}, the bounding box is always set snugly around the drawing \emph{without} text. There is debate about whether this is a bug in Inkscape or not. This becomes a problem when text is desired `outside' the other parts of the drawing. A workaround is drawing a rectangle with zero stroke width as bounding box around the drawing. Alternatively, one can export to PS+\LaTeX{} instead and renaming the resulting {\small\verb|.ps|} file to {\small\verb|.eps|}. See \url{https://bugs.launchpad.net/inkscape/+bug/595821}. + \item Exporting to EPS+LaTeX, the bounding box is always set snugly around the drawing \emph{without} text. There is debate about whether this is a bug in Inkscape or not. This becomes a problem when text is desired `outside' the other parts of the drawing. A workaround is drawing a rectangle with zero stroke width as bounding box around the drawing. Alternatively, one can export to PS+LaTeX instead and renaming the resulting {\small\verb|.ps|} file to {\small\verb|.eps|}. See \url{https://bugs.launchpad.net/inkscape/+bug/595821}. \item Flowed text is only exported for rectangular flow shapes. - \item There are no other scaling options beside specifying the width. + \item The height of the figure cannot be specified. + \item It is not possible to use newlines in unflowed text. \end{itemize} \end{document} diff --git a/Master/texmf-dist/doc/latex/svg-inkscape/README b/Master/texmf-dist/doc/latex/svg-inkscape/README index 5423152b6db..8af2a10f465 100644 --- a/Master/texmf-dist/doc/latex/svg-inkscape/README +++ b/Master/texmf-dist/doc/latex/svg-inkscape/README @@ -9,9 +9,9 @@ PDF+LaTeX using Inkscape. ------------------------------------------------------------------- - Author: Johan B. C. Engelen (goejendaagh at zonnet.nl) - Copyright 2010 J.B.C. Engelen - Version 2010-07-07 + Author: Johan B. C. Engelen (j.b.c.engelen at alumnus.utwente.nl) + Copyright 2010-2013 J.B.C. Engelen + Version 2013-11-21 This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either @@ -33,3 +33,11 @@ image-normal.pdf (image.svg exported without PDF+LaTeX option) image.pdf (image.svg exported with PDF+LaTeX option) image.pdf_tex (image.svg exported with PDF+LaTeX option) InkscapePDFLaTeX.pdf + + +------------------------------------------------------------------- + Version info + + 2011-11-21 + - updated e-mail address + - added 0.49 functionality (scaling, bold/italic font shape) diff --git a/Master/texmf-dist/doc/latex/svg-inkscape/image-normal.pdf b/Master/texmf-dist/doc/latex/svg-inkscape/image-normal.pdf index 98231618dff..87833b23f27 100644 Binary files a/Master/texmf-dist/doc/latex/svg-inkscape/image-normal.pdf and b/Master/texmf-dist/doc/latex/svg-inkscape/image-normal.pdf differ diff --git a/Master/texmf-dist/doc/latex/svg-inkscape/image.pdf b/Master/texmf-dist/doc/latex/svg-inkscape/image.pdf index b710c16c389..bf49800e6c5 100644 Binary files a/Master/texmf-dist/doc/latex/svg-inkscape/image.pdf and b/Master/texmf-dist/doc/latex/svg-inkscape/image.pdf differ diff --git a/Master/texmf-dist/doc/latex/svg-inkscape/image.pdf_tex b/Master/texmf-dist/doc/latex/svg-inkscape/image.pdf_tex index e27f06664e0..a928cdbeea2 100644 --- a/Master/texmf-dist/doc/latex/svg-inkscape/image.pdf_tex +++ b/Master/texmf-dist/doc/latex/svg-inkscape/image.pdf_tex @@ -1,4 +1,4 @@ -%% Creator: Inkscape 0.47+devel, www.inkscape.org +%% Creator: Inkscape 0.48+devel, www.inkscape.org %% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010 %% Accompanies image file 'image.pdf' (pdf, eps, ps) %% @@ -37,20 +37,27 @@ \providecommand\rotatebox[2]{#2} \ifx\svgwidth\undefined \setlength{\unitlength}{212.525pt} + \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.73650159)% \put(0,0){\includegraphics[width=\unitlength]{image.pdf}}% - \put(0.63829642,0.6742451){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{\emph{Inkscape}}}}% + \put(0.64128088,0.68469074){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Ink{\itshape{}scape}}}}% \put(0.84173702,0.1474823){\color[rgb]{1,0,0}\makebox(0,0)[lb]{\smash{red}}}% \put(0.02294317,0.07460173){\color[rgb]{0,0,0}\rotatebox{45}{\makebox(0,0)[lb]{\smash{45 graden}}}}% \put(0.69834718,0.60455928){\color[rgb]{0,0,0}\makebox(0,0)[b]{\smash{$\lim_{n \to \infty}\sum_{k=1}^n \frac{1}{k^2}$}}}% \put(0.11403042,0.69180401){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Einstein \eqref{eq:emc2}}}}% \put(0.81701383,0.48297822){\color[rgb]{0,0,0}\makebox(0,0)[b]{\smash{ooo}}}% - \put(0.46667722,0.21504382){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\begin{minipage}{0.21488139\unitlength}\tiny Flowed text also works. This is a test text to see that it \emph{does} work. \\ But, it only works for rectangular flow shapes.\end{minipage}}}% + \put(0.46667722,0.21504382){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\begin{minipage}{0.21488139\unitlength}\tiny Flowed text also works. This is a test text to see that it {\bfseries{}does} work. +But, it only works for rectangular flow shapes.\end{minipage}}}% \put(0.77784162,0.05718502){\color[rgb]{0,0,1}\makebox(0,0)[lb]{\smash{blue}}}% \put(0.81761682,0.10755617){\color[rgb]{0,1,0}\makebox(0,0)[lb]{\smash{green}}}% \put(0.10913692,0.04673474){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{aligned on baseline}}}% diff --git a/Master/texmf-dist/doc/latex/svg-inkscape/image.svg b/Master/texmf-dist/doc/latex/svg-inkscape/image.svg index e2d0e5bff63..b3b44148a54 100644 --- a/Master/texmf-dist/doc/latex/svg-inkscape/image.svg +++ b/Master/texmf-dist/doc/latex/svg-inkscape/image.svg @@ -13,7 +13,7 @@ height="1052.3622047" id="svg2" version="1.1" - inkscape:version="0.47+devel" + inkscape:version="0.48+devel r10080" sodipodi:docname="image.svg"> @@ -60,17 +60,17 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="5.045144" - inkscape:cx="406.68428" - inkscape:cy="661.35351" + inkscape:zoom="1.7837278" + inkscape:cx="454.47927" + inkscape:cy="703.41038" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" inkscape:snap-bbox="true" showguides="true" inkscape:guide-bbox="true" - inkscape:window-width="1364" - inkscape:window-height="712" + inkscape:window-width="1680" + inkscape:window-height="994" inkscape:window-x="-4" inkscape:window-y="-4" inkscape:window-maximized="1" @@ -129,7 +129,7 @@ inkscape:connector-curvature="0" /> + transform="matrix(0.5,-0.8660254,0.8660254,0.5,7.8960431,472.90755)"> \emph{Inkscape} + sodipodi:role="line">Inkscape \tiny Flowed text also works. This is a test text to see that it \emph{does} work. \tiny Flowed text also works. This is a test text to see that it does work. But, it only works for rectangular flow shapes.