1

I'm using Tex Text in Inkscape (0.91) on a Mac (OS Sierra) (with MacTex) and it's basically functional, but I can't seem to use a preamble file (.ini). I've tried having a very simple preamble file of \usepackage{amsmath} but that results in the following error output:

 Traceback (most recent call last):
  File "textext.py", line 210, in cb_ok
    self.callback(self.text, self.preamble_file, self.scale_factor)
  File "textext.py", line 369, in <lambda>
    converter_cls, old_node))
  File "textext.py", line 387, in do_convert
    new_node = converter.convert(text, preamble_file, scale_factor)
  File "textext.py", line 875, in convert
    return PdfConverterBase.convert(self, *a, **kw)
  File "textext.py", line 750, in convert
    self.tex_to_pdf(latex_text, preamble_file)
  File "textext.py", line 727, in tex_to_pdf
    exec_command(['/Library/TeX/texbin/pdflatex', self.tmp('tex')] + latexOpts)
  File "textext.py", line 596, in exec_command
    % (' '.join(cmd), p.returncode, out + err))
RuntimeError: Command /Library/TeX/texbin/pdflatex /var/folders/cr/6n190wb14px1csr_s38dgp_m0000gp/T/tmpcoRZLT/tmp.tex -interaction=nonstopmode -halt-on-error failed (code 1): This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(/var/folders/cr/6n190wb14px1csr_s38dgp_m0000gp/T/tmpcoRZLT/tmp.tex
LaTeX2e <2016/03/31>
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/size10.clo))
! Undefined control sequence.
l.3         {\rtf
                 1\ansi\ansicpg1252\cocoartf1504
? 
! Emergency stop.
l.3         {\rtf
                 1\ansi\ansicpg1252\cocoartf1504
!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on tmp.log.

Any ideas on what could be causing this error?

jon
  • 22,325
itf
  • 151
  • What is on line three of this file? Have you defined or neglected to define a command called \rtf? (Note that, for *TeX-related problems, it is usually very important to post a stripped down and minimal .tex file that produces the error you are trying to fix. This is sometimes called a minimal example. – jon Oct 29 '16 at 01:09
  • The preamble file literally contains only the one line: \usepackage{ams math}, so there is no line three in this file. – itf Oct 29 '16 at 01:24
  • 1
    Well, \usepackage{ams math} (note the space) should fail (I'm surprised to learn it does not; but use \usepackage{amsmath} in the future), but not with the error you are describing. But are you trying to compile your preamble? Because, if not, even the most minimal (but complete) LaTeX file will have at least three lines.... – jon Oct 29 '16 at 01:27
  • Sorry, that was a typo on my part (stupid new computer auto-corrects everything I type). The preamble file I'm describing only contains \usepackage{amsmath}. I believe TexText tries to compile the preamble (which is a .ini, not .tex file) in order to generate Latex objects in Inkscape. Does the "most minimal (but complete)...three lines" rule apply to .ini preamble files as well? – itf Oct 29 '16 at 18:50
  • I'm not sure, to be honest. I don't use Inkscape very much and have never used TexText. By compile, do you mean it is trying to create a format file (see, e.g., this question)? In a normal LaTeX document, you can't compile just the preamble in the normal sense of the word. As an aside: I is there a group dedicated to Inkscape somewhere? You might find more people there who have good working knowledge of what Inkscape is up to.... – jon Oct 29 '16 at 19:38

2 Answers2

1

I can't give you a definite answer and would rather only write a comment, but TeX.SE won't let me.

As a diagnostic step, I would try to get hold of the temporary TeX file that textext writes to file and compile it manually. You might edit your textext.py file as follows:

  
    # comment out the command that calls LaTeX  
    # exec_command(['/Library/TeX/texbin/pdflatex', self.tmp('tex')] + latexOpts)
    print 'options', latexOpts
    print 'temp file', self.tmp('tex')
    # quit after printing diagnostic output
    raise SystemExit 

that should give you the location of the temp file. Open it in your TeX editor, inspect, and try to compile. Then you can find out whether textext writes a broken file or uses broken options, or whether there is something else wrong with your setup.

0

I found a working solution for version 1.4: In the Inkscape extensions folder, which can be found at 'C:\Users\Username\AppData\Roaming\inkscape\extensions\textext' for Windows, edit the base.py file as follows:

The class TexToPdfConverter at Line 747 starts with:

**YOUR DOCUMENT CLASS and PREAMBLE GOES HERE**
DOCUMENT_TEMPLATE = r"""
\documentclass{article}
%s
\pagestyle{empty}
\begin{document}
%s
\end{document}
"""

Then just use the TexText extension as usual.

fk98
  • 1