LyXinput .pdf_tex from Inkscape in a Lyx figure

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
VorteX
Posts: 3
Joined: Wed Aug 19, 2015 4:27 pm

input .pdf_tex from Inkscape in a Lyx figure

Post by VorteX »

Hello Lyx Useres,

I'm really frustrated. I'm trying for houers to add a drawing from Inkscape (PDF+LaTeX format) into Lyx. I didn't find anything helpfully in this matter on google.

What I did: Inkscape generate two files: the fist one is a .pdf_tex file with coordinates of the text, see code below, the second file is the drawing. After that, I added in the Latex preamble in the document Settings.

Code: Select all

\usepackage{graphicx}
\usepackage{color}
After that, I added in the Lyx document browser a figure float with a TEX box instead of a figure file. In the TEX box I wrote:

Code: Select all

\input{Zeichnung.pdf_tex}
(compare the screenshot in the attachment) When I am trying to make a PDF file in Lyx I get a error message like: LyX: The file can't be viewed. The file dosen't exist: C:\Users\...\new_document1.pdf

What's drive me crazy: I exported wiht Lyx the pdflatex code. With TexWorks I am able to generate a PDF file with the drwaing and the text at the right positions.

So what's wrong here? I haven't really got a clue! Please help me in this matter. It's important to me, to have the same font in all my Pictures in my whole master thesis.
PS: Sorry for my english, I'm a german ;-)

Code: Select all

%% LyX 2.1.3 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{graphicx}
\usepackage{color}

\makeatother

\usepackage{babel}
\begin{document}
Testtext

\begin{figure}
\input{Zeichnung.pdf_tex}

\protect\caption{Testabbildung}
\end{figure}

\end{document}

Code: Select all

%% Creator: Inkscape 0.91_64bit, www.inkscape.org
%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010
%% Accompanies image file 'Zeichnung.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}{595.27559055bp}%
    \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,1.41428571)%
    \put(0,0){\includegraphics[width=\unitlength,page=1]{Zeichnung.pdf}}%
    \put(0.40439913,1.0356032){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Testabbildung\\ Umbruch}}}%
  \end{picture}%
\endgroup%
Zeichnung1.png
Zeichnung1.png (166.57 KiB) Viewed 10377 times
Last edited by cgnieder on Wed Sep 09, 2015 8:06 pm, edited 1 time in total.

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: input .pdf_tex from Inkscape in a Lyx figure

Post by Stefan Kottwitz »

Hi VorteX,

welcome to the forum!

I'm sorry that you did not get an answer yet. Perhaps the issue seemed a bit unclear.

Were you already able to fix the problem yourself? If yes, what caused the error? It would be nice to read it.

Otherwise: could you please post the .log file, which LyX generates? Perhaps it does not find an image, or stops because of another error.

Stefan
LaTeX.org admin
VorteX
Posts: 3
Joined: Wed Aug 19, 2015 4:27 pm

input .pdf_tex from Inkscape in a Lyx figure

Post by VorteX »

Hello Stefan_K,

good idea to check the .log file. Now I know what the error causes, but I have still no clue how to fix it. I get this error message cause the PDF file can't create. So, there is no PDF file to open and Lyx shows the error message. The interesting line is this one:

Code: Select all

12:39:59.054: pdflatex: Windows API error 1113: Für das Unicode-Zeichen ist kein zugeordnetes Zeichen in der Mehrbytecodepage vorhanden.
I try to generate the drawing without any text, to avoid the use of ö, ä or ü. But the error still occurs.

Code: Select all

12:39:58.664: Generiere Vorschau ...
12:39:58.679: (buffer-view: Ctrl+R)
12:39:58.773: pdflatex  "Neues_Dokument1.tex"
12:39:58.867: This is pdfTeX, Version 3.14159265-2.6-1.40.15 (MiKTeX 2.9)
12:39:58.867: entering extended mode
12:39:58.913: (Neues_Dokument1.tex
12:39:58.913: LaTeX2e <2014/05/01>
12:39:58.913: Babel <3.9l> and hyphenation patterns for 68 languages loaded.
12:39:58.913: 
12:39:59.054: pdflatex: Windows API error 1113: Für das Unicode-Zeichen ist kein zugeordnetes Zeichen in der Mehrbytecodepage vorhanden.

..\..\..\src\support\Systemcall.cpp (292): Systemcall: 'pdflatex  "Neues_Dokument1.tex"' finished with exit code 1
Error: Die Datei kann nicht betrachtet werden.
----------------------------------------
Die Datei existiert nicht: C:/Users/Franz/AppData/Local/Temp/lyx_tmpdir.xGhWpUWx3992/lyx_tmpbuf0/Neues_Dokument1.pdf
12:40:01.275: Fehler bei der Vorschau des Formats PDF (pdflatex)
12:41:24.733: Automatische Speicherung abgeschlossen.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

input .pdf_tex from Inkscape in a Lyx figure

Post by Stefan Kottwitz »

There's a bug report for this error message, but I don't know if it would apply to the situation with your code and file.

Perhaps isolate it further: try a different simple PDF with the same code. Perhaps the PDF file has invalid characters (umlauts?) or fonts in it, which cannot be processed by LyX/TeX.

Stefan
LaTeX.org admin
VorteX
Posts: 3
Joined: Wed Aug 19, 2015 4:27 pm

input .pdf_tex from Inkscape in a Lyx figure

Post by VorteX »

In my post below, I took care of the umlauts.
VorteX wrote: I try to generate the drawing without any text, to avoid the use of ö, ä or ü. But the error still occurs.
I haven't much time to solve this issue, because I write my master thesis. But anyway, I was running another test: I draw a rectangel without any text. I used the same code like in my first post. Same error occures, but now no API error 1113 in the logfile. I haven't any clue what's wrong here.

Code: Select all

This is pdfTeX, Version 3.14159265-2.6-1.40.15 (MiKTeX 2.9) (preloaded format=pdflatex 2015.3.26)  16 SEP 2015 08:12
entering extended mode
**test.tex
(test.tex
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 68 languages loaded.

("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\size10.clo"
File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
) ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\fontenc.sty"
Package: fontenc 2005/09/27 v1.99g Standard LaTeX package
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\t1enc.def"
File: t1enc.def 2005/09/27 v1.99g Standard LaTeX file
LaTeX Font Info:    Redeclaring font encoding T1 on input line 43.
)) ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\inputenc.sty"
Package: inputenc 2014/04/30 v1.2b Input encoding file
\inpenc@prehook=\toks14
\inpenc@posthook=\toks15
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\latin9.def"
File: latin9.def 2014/04/30 v1.2b Input encoding file
)) ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\graphicx.sty"
Package: graphicx 2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\keyval.sty"
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks16
) ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\graphics.sty"
Package: graphics 2014/10/28 v1.0p Standard LaTeX Graphics (DPC,SPQR)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\trig.sty"
Package: trig 1999/03/16 v1.09 sin cos tan (DPC)
) ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\00miktex\graphics.cfg"
File: graphics.cfg 2007/01/18 v1.5 graphics configuration of teTeX/TeXLive
)
Package graphics Info: Driver file: pdftex.def on input line 91.
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\pdftex-def\pdftex.def"
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\infwarerr.sty"
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO)
) ("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\ltxcmds.sty"
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
)
\Gread@gobject=\count87
))
\Gin@req@height=\dimen103
\Gin@req@width=\dimen104
) ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\color.sty"
Package: color 2014/10/28 v1.1a Standard LaTeX Color (DPC)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\00miktex\color.cfg"
File: color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
)
Package color Info: Driver file: pdftex.def on input line 137.
) ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\babel\babel.sty"
Package: babel 2014/09/25 3.9l The Babel package
*************************************
* Local config file bblopts.cfg used
*
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\00miktex\bblopts.cfg"
File: bblopts.cfg 2006/07/31 v1.0 MiKTeX 'babel' configuration
) ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\babel-english\english.ldf"
Language: english 2012/08/20 v3.3p English support from the babel system
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\babel\babel.def"
File: babel.def 2014/09/25 3.9l Babel common definitions
\babel@savecnt=\count88
\U@D=\dimen105
)
\l@canadian = a dialect from \language\l@american 
\l@australian = a dialect from \language\l@british 
\l@newzealand = a dialect from \language\l@british 
))
No file test.aux.
LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 17.
LaTeX Font Info:    ... okay on input line 17.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 17.
LaTeX Font Info:    ... okay on input line 17.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 17.
LaTeX Font Info:    ... okay on input line 17.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 17.
LaTeX Font Info:    ... okay on input line 17.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 17.
LaTeX Font Info:    ... okay on input line 17.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 17.
LaTeX Font Info:    ... okay on input line 17.
("C:\Program Files (x86)\MiKTeX 2.9\tex\context\base\supp-pdf.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count89
\scratchdimen=\dimen106
\scratchbox=\box26
\nofMPsegments=\count90
\nofMParguments=\count91
\everyMPshowfont=\toks17
\MPscratchCnt=\count92
\MPscratchDim=\dimen107
\MPnumerator=\count93
\makeMPintoPDFobject=\count94
\everyMPtoPDFconversion=\toks18
) (D:/Universität/1Diplomarbeit/Diplomarbeit//drawing.pdf_tex
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

input .pdf_tex from Inkscape in a Lyx figure

Post by Stefan Kottwitz »

Hi,
VorteX wrote:I haven't much time to solve this issue, because I write my master thesis.
sure. In case of a problem, perhaps don't invest much time in solving yourself then, but simply post it here, we try to help.

Can you please post such Inkscape sample images in SVG format here, as attachment? We could take a look if they would be easy to draw in LaTeX natively, using TikZ, or using a conversion.

Stefan
LaTeX.org admin
Post Reply