Tex text in Inkscape: problem with the preamble

Post questions on how to use or achieve an effect in Inkscape.
Radioman

Tex text in Inkscape: problem with the preamble

Postby Radioman » Fri Sep 10, 2010 7:32 am

After searching the web, this forum and the guidelines for asking questions, I am filled with trepidation and terror as I ask for your help. :D
I have only used Inkscape and the 'Tex text' extension for two days, and so far it has worked beautifully on standard LaTeX symbols.

However, now I want to use \mathbb{R} from the amsfonts package, and I have run into some problems. I suppose the package is to be imported in the preamble file you can choose in the Tex text window, but I just can't get it to work. Can someone show me an example of what a preamble file for Tex text should look like?

Thanks!

Radioman

Re: Tex text in Inkscape: problem with the preamble

Postby Radioman » Sat Sep 11, 2010 9:20 am

I found out what my problem was.

The very first and obvious choice was to have a preamble file that only included
\usepackage{amsfonts}
but I didn't get that to work, and I ended up trying a whole bunch of other things.

The problem, however, was that I tried to load ".tex"-files as the preamble file, but that doesn't work.
Textext requires a normal text-file, or it won't work.

I just made a 'head.ini' that only included the usepackage line, and it worked immediately.

So, nothing to see here folks, Move along! :)

Guest

Re: Tex text in Inkscape: problem with the preamble

Postby Guest » Fri Nov 05, 2010 10:39 pm

I had the same problem. Many thanks for posting the solution!

sojourn
Posts: 3
Joined: Mon Nov 29, 2010 11:28 am

Re: Tex text in Inkscape: problem with the preamble

Postby sojourn » Mon Dec 13, 2010 3:32 am

Mines working but I'm I'm still getting the errors:
I'm using Ubuntu 10.10 "code name Maverick Meerkat" with Inkscape 0.48 I did the following:

1) Download Inkscape 0.48 using Software Center in Ubuntu.
a) Applications -> Ubuntu Software Center
b) Click on Graphics.
c) Scroll down to find Inkscape.
d) Click the install button.

If you use Synaptic Package Manager "System -> Administration -> Synaptic Package Manager" to download and install Inkscape it will download version 0.47 NOT 0.48
Maybe there's a way using the the terminal but I couldn't find the right package name. It's usually:
1) Applications -> Accessories -> Terminal
2) Type: sudo apt-get install ThePackageNameHere
The download page shows the packages as:
inkscape_0.48.0-1ubuntu1_i386.deb "For Intel processors"
inkscape_0.48.0-1ubuntu1_amd64.deb "For amd 64bit processors"
http://packages.ubuntu.com/maverick/graphics/inkscape "Download inkscape at the bottom of the page"

2) Download textex http://pav.iki.fi/software/textext/ listed about half way down the page. For Ubuntu it's http://pav.iki.fi/software/textext/textext-0.4.4.tar.gz
a) A dialog box should appear. Select either Archive Manager or "Save File"
b) Go to the folder where you downloaded the file. If you using Firefox like I am, it's automatically saved to: home\owner\downloads.
This is set in Firefox in Edit -> Preferences -> General
You can get to it from the desktop by clicking on Places -> Downloads
b) If you just save it you'll then need to extract it by right clicking and select: Open with archive manger.

The two resulting files: textext.py and textext.inx must be placed in Inkscape/Extensions, but to copy them to the folder you must enable permissions for the two files and the destination.
3) Applications -> Accessories -> Terminal
a) Type: cd \Downloads ( cd is "Change directory", Yes it must be a captal "D" )
b) Type: sudo chmod 777 textext.py "Then press enter"
c) Type: sudo chmod 777 textext.inx "Then press enter"
d) Type: sudo chmod 777 /usr/share/inkscape/extensions "Then press enter"
e) Type: cp textext.py /usr/share/inkscape/extensions "Then press enter"
f) Type: cp textext.inx /usr/share/inkscape/extensions "Then press enter"

4) Create the preamble file, From the desktop:
a) Applications -> Accessories -> Gedit
b) On the first line type: \usepackage{amsfonts}
c) File -> Save as:
d) Type: AnyNameYouWantHere.ini
e) Click: Save

5) launch Inkscape, from the desktop:
a) Applications -> Graphics
b) Go to: Extensions -> textext
c) In the dialog box where it says: "Preamble" navigate to: AnyNameYouWantHere.ini
d) In the text box type: Testing
e) Click: OK

A message box will appear with errors shown below. Just click "OK" and it will work anyway.
Inkscape has received additional data from the script executed. The script did not return an error, but this may indicate the results will not be as expected.

textext.py:55: DeprecationWarning: the md5 module is deprecated; use hashlib instead
import os, sys, tempfile, traceback, glob, re, md5, copy


Some commands for font size in math mode don't work such as:

Code: Select all

\begin{Large} \end{Large}

You just use the following for everything:

Code: Select all

     \tiny
     \scriptsize
     \footnotesize
     \small
     \normalsize
     \large
     \Large
     \LARGE
     \huge
     \Huge

sebas
Posts: 3
Joined: Tue Oct 25, 2016 5:43 am

Re: Tex text in Inkscape: problem with the preamble

Postby sebas » Tue Oct 25, 2016 6:55 am

Hello!

I'm using Inkscape 0.48.5 in Windows 8.

I'm trying the following simple code in the teX text window

$\mathbb{R}$

and using a preambule.ini file with the text

\usepackage{amsfonts}

But it doesn´t work and produces the following error

Code: Select all

Traceback (most recent call last):
  File "textext.py", line 212, in cb_ok
    self.callback(self.text, self.preamble_file, self.scale_factor)
  File "textext.py", line 371, in <lambda>
    converter_cls, old_node))
  File "textext.py", line 389, in do_convert
    new_node = converter.convert(text, preamble_file, scale_factor)
  File "textext.py", line 752, in convert
    self.tex_to_pdf(latex_text, preamble_file)
  File "textext.py", line 729, in tex_to_pdf
    exec_command(['pdflatex', self.tmp('tex')] + latexOpts)
  File "textext.py", line 598, in exec_command
    % (' '.join(cmd), p.returncode, out + err))
RuntimeError: Command pdflatex c:\users\sebast~1\appdata\local\temp\tmpxt1c3y\tmp.tex -interaction=nonstopmode -halt-on-error failed (code 1): This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9)
entering extended mode
(c:/users/sebast~1/appdata/local/temp/tmpxt1c3y/tmp.tex
LaTeX2e <2011/06/27>
Babel <v3.8m>

...

("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\size10.clo"))
LaTeX Warning: Unused global option(s): [a0].
No file tmp.aux.
! Undefined control sequence.
<recently read> \mathbb
l.7         $\mathbb{R}$
!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on tmp.log.

I have no problems with other codes like
$\mathcal{C}$
or typing text, so the problem is likely related to the preamble file.
Can anyone help me, please?
Thank you!
Last edited by sebas on Wed Oct 26, 2016 4:02 am, edited 4 times in total.

User avatar
prkos
Posts: 1625
Joined: Tue Nov 06, 2007 8:45 am
Location: Croatia

Re: Tex text in Inkscape: problem with the preamble

Postby prkos » Tue Oct 25, 2016 1:52 pm

Welcome to the forum sebas!

I don't have a lot of experience with teX so I can't help with your question, but I'm sure someone more knowledgable would come along.

In the meantime, are you sure you don't have any typos, maybe in file names? Have you tried what had been suggested in the previous replies?
just hand over the chocolate and nobody gets hurt

Inkscape Manual on Floss
Inkscape FAQ
very comprehensive Inkscape guide
Inkscape 0.48 Illustrator's Cookbook - 109 recipes to learn and explore Inkscape - with SVG examples to download

sebas
Posts: 3
Joined: Tue Oct 25, 2016 5:43 am

Re: Tex text in Inkscape: problem with the preamble

Postby sebas » Wed Oct 26, 2016 2:29 am

Thank you very much! Of course, I have revised the code many times and followed the suggestions, but it doesn't work yet.

hulf2012
Posts: 716
Joined: Sat Nov 24, 2012 12:37 pm

Re: Tex text in Inkscape: problem with the preamble

Postby hulf2012 » Wed Oct 26, 2016 3:09 am

Hello

Please, if you can, edit and increase the size of the error log and, or put inside "code" tags.

The last lines in your log:

Code: Select all

! ==> Fatal error occurred, no output PDF file produced!
Transcript written on tmp.log.


Can your provide that "tmp.log"

Do You have installed correctly all the LaTeX distribution in Windows ?( MikTex?)

Are You sure that Inkscape can recognize correctly the LaTeX distribution and the extension?
Please see here:
http://tavmjong.free.fr/INKSCAPE/MANUAL ... sions.html

Maybe the extensions log can say us something else.

I'm NOT a LaTeX expert neither.

Also, please check if there is a Launchpad bug related:

launchpad

-Why are You using Inkscape 0.48.5 if the las one is Inkscape 0.91?
- Maybe it's not related, but are you in Windows 10 in a modern machine?. I ask this because I see that MikTex is in "Program Files (x32)"??

Good luck
If you have problems:
1.- Post a sample (or samples) of your file please.
2.- Please check here:
http://tavmjong.free.fr/INKSCAPE/MANUAL/html/index.html
3.- If you manage to solve your problem, please post here your solution.

sebas
Posts: 3
Joined: Tue Oct 25, 2016 5:43 am

Re: Tex text in Inkscape: problem with the preamble

Postby sebas » Thu Oct 27, 2016 9:06 am

I´m not able to find the tmp.log file. I suppose it should be placed in the folder
c:/users/sebast~1/appdata/local/temp/tmpxt1c3y
but it seems that temporary files are being deleted.


Return to “Help with using Inkscape”