In deed the problem was that the username has an accent. I made a new
username without it and everything worked.

thanks,
Jose

On Mon, Feb 5, 2018 at 11:16 AM, José María Miotto <[email protected]>
wrote:

> well, it is only a guess that the character is not well-read, and I guess
> it should happen as well if I import other packages, but amsmath, for
> example, is imported with no problem.
>
> On Mon, Feb 5, 2018 at 3:04 PM, José María Miotto <[email protected]>
> wrote:
>
>> Hi, thanks for running the code.
>>
>> The color package is correctly installed, I think, since I can compile
>> colored text in latex outside pyx.
>> I printed the full error, which I report below. It seems that at the end
>> pyx does not find the pyx.def. I searched it in the HD and I found the file
>> in the correct folder; however, I think I found the problem, my username
>> has an accent, and clearly tex interprets that utf8 character wrong:
>>   ! LaTeX Error: File `*C:/Users/JOS\unhbox\voidb@x \penalty \@M \
>> {}1/AppData/Loc*
>> *  al/Temp/pyxeg9r80wk/pyx.def*' not found.
>>
>> Now, is strange that this happens when latex is run by pyx, but not
>> normally when compiling a document.
>>
>> best,
>> Jose
>>
>>
>> The expression passed to TeX was:
>>   \usepackage{color}%
>>   \PyXInput{4}%
>> The return message from TeX was:
>>   *
>>   *(c:/texlive/2017/texmf-dist/tex/latex/graphics/color.sty
>>   (c:/texlive/2017/texmf-dist/tex/latex/graphics-cfg/color.cfg)
>>   ! Missing \endcsname inserted.
>>   <to be read again>
>>                      \protect
>>   l.148   \@ifundefined{ver@\Gin@driver}
>>                                         {\input{\Gin@driver}}{}
>>
>>   ! LaTeX Error: Missing \begin{document}.
>>
>>   See the LaTeX manual or LaTeX Companion for explanation.
>>   Type  H <return>  for immediate help.
>>    ...
>>
>>   l.148   \@ifundefined{ver@\Gin@driver}
>>                                         {\input{\Gin@driver}}{}
>>   ! Extra \endcsname.
>>   \@ifundefined ...dafter \ifx \csname #1\endcsname
>>                                                     \relax \expandafter
>> \@firs...
>>   l.148   \@ifundefined{ver@\Gin@driver}
>>                                         {\input{\Gin@driver}}{}
>>
>>   ! LaTeX Error: File `
>> *C:/Users/JOS\unhbox\voidb@x \penalty \@M \ {}1/AppData/Loc
>> al/Temp/pyxeg9r80wk/pyx.def*' not found.
>>
>>   Type X to quit or <RETURN> to proceed,
>>   or enter new name. (Default extension: def)
>> After parsing the return message from TeX, the following was left:
>>   *
>>   *(c:/texlive/2017/texmf-dist/tex/latex/graphics/color.sty
>>   (c:/texlive/2017/texmf-dist/tex/latex/graphics-cfg/color.cfg)
>>   ! Missing \endcsname inserted.
>>   <to be read again>
>>                      \protect
>>   l.148   \@ifundefined{ver@\Gin@driver}
>>                                         {\input{\Gin@driver}}{}
>>
>>   ! LaTeX Error: Missing \begin{document}.
>>
>>   See the LaTeX manual or LaTeX Companion for explanation.
>>   Type  H <return>  for immediate help.
>>    ...
>>
>>   l.148   \@ifundefined{ver@\Gin@driver}
>>                                         {\input{\Gin@driver}}{}
>>   ! Extra \endcsname.
>>   \@ifundefined ...dafter \ifx \csname #1\endcsname
>>                                                     \relax \expandafter
>> \@firs...
>>   l.148   \@ifundefined{ver@\Gin@driver}
>>                                         {\input{\Gin@driver}}{}
>>
>>   ! LaTeX Error: File `
>> *C:/Users/JOS\unhbox\voidb@x \penalty \@M \ {}1/AppData/Loc
>> al/Temp/pyxeg9r80wk/pyx.def*' not found.
>>
>> On Mon, Feb 5, 2018 at 12:54 PM, Michael Hartmann <
>> [email protected]> wrote:
>>
>>> Dear Jose,
>>>
>>> I tried your code on my machine (Linux) and it works as expected. Maybe
>>> you
>>> have a problem with your LaTeX-Installation? What is in the file
>>> errordetail.full? Is the package color installed correctly?
>>>
>>> --Michael
>>>
>>> Am 05.02.2018 um 12:50 schrieb José María Miotto:
>>> >  Hi, I'm having problems with text in color. I solved this issue years
>>> ago
>>> > on my old machine, but now I bought a new laptop, and I installed
>>> > everything from scratch (windows os, texlive, anaconda, pyx), and I
>>> don't
>>> > have a clue of how I solved it before.
>>> >
>>> > Basically, the code is this
>>> >
>>> > from pyx import *
>>> > text.set(text.LatexRunner)
>>> > text.preamble(r'\usepackage{color}')
>>> >
>>> > c = canvas.canvas()
>>> > a = '\\textcolor[rgb]{1,0,0}{x}'
>>> > c.text(0, 0, a)
>>> > c.writePDFfile('./plots/test')
>>> >
>>> > and this code fails, although is very similar to the example in the
>>> > documentation. The full output is this:
>>> >
>>> >
>>> > Still waiting for LaTeX after 5 (of 60) seconds...
>>> > Still waiting for LaTeX after 10 (of 60) seconds...
>>> > Still waiting for LaTeX after 15 (of 60) seconds...
>>> > Still waiting for LaTeX after 20 (of 60) seconds...
>>> > Still waiting for LaTeX after 25 (of 60) seconds...
>>> > Still waiting for LaTeX after 30 (of 60) seconds...
>>> > Still waiting for LaTeX after 35 (of 60) seconds...
>>> > Still waiting for LaTeX after 40 (of 60) seconds...
>>> > Still waiting for LaTeX after 45 (of 60) seconds...
>>> > Still waiting for LaTeX after 50 (of 60) seconds...
>>> > Still waiting for LaTeX after 55 (of 60) seconds...
>>> > The timeout of 60 seconds expired and LaTeX did not respond.
>>> > Traceback (most recent call last):
>>> >   File "C:\Program Files\JetBrains\PyCharm
>>> > 2017.3.3\helpers\pydev\pydev_run_in_console.py",
>>> > line 53, in run_file
>>> >     pydev_imports.execfile(file, globals, locals)  # execute the script
>>> >   File "C:\Program Files\JetBrains\PyCharm
>>> > 2017.3.3\helpers\pydev\_pydev_imps\_pydev_execfile.py",
>>> > line 18, in execfile
>>> >     exec(compile(contents+"\n", file, 'exec'), glob, loc)
>>> >   File "C:/Users/José/PycharmProjects/anomalies/test.py", line 3, in
>>> > <module>
>>> >     text.preamble(r'\usepackage{color}')
>>> >   File "C:\ProgramData\Anaconda3\lib\site-packages\pyx\text.py", line
>>> 1454,
>>> > in preamble
>>> >     self.instance.preamble(expr, texmessages)
>>> >   File "C:\ProgramData\Anaconda3\lib\site-packages\pyx\text.py", line
>>> 1245,
>>> > in preamble
>>> >     self.do_preamble(expr, texmessages)
>>> >   File "C:\ProgramData\Anaconda3\lib\site-packages\pyx\text.py", line
>>> 1196,
>>> > in do_preamble
>>> >     self._execute(expr, texmessages, STATE_PREAMBLE, STATE_PREAMBLE)
>>> >   File "C:\ProgramData\Anaconda3\lib\site-packages\pyx\text.py", line
>>> 1125,
>>> > in _execute
>>> >     raise e
>>> >   File "C:\ProgramData\Anaconda3\lib\site-packages\pyx\text.py", line
>>> 1083,
>>> > in _execute
>>> >     raise TexResultError("TeX didn't respond as expected within the
>>> timeout
>>> > period.")
>>> > pyx.text.TexResultError: TeX didn't respond as expected within the
>>> timeout
>>> > period.
>>> > The expression passed to TeX was:
>>> >   \usepackage{color}%
>>> >   \PyXInput{4}%
>>> > After parsing the return message from TeX, the following was left:
>>> >   *
>>> >   *(c:/texlive/2017/texmf-dist/tex/latex/graphics/color.sty
>>> >   (c:/texlive/2017/texmf-dist/tex/latex/graphics-cfg/color.cfg)
>>> >   ! Missing \endcsname inserted.
>>> >   <to be read again>
>>> >   (cut after 5 lines; use errordetail.full for all output)
>>> >
>>> >
>>> > I tried the other option for the preamble that is mentioned in the
>>> > documentation,
>>> >
>>> > from pyx import *
>>> > text.set(text.LatexRunner, pyxgraphics=0)
>>> > text.preamble(r'\usepackage[pyx]{color}')
>>> >
>>> > c = canvas.canvas()
>>> > a = '\\textcolor[rgb]{1,0,0}{x}'
>>> > c.text(0, 0, a)
>>> > c.writePDFfile('./plots/test')
>>> >
>>> >
>>> > which also fails, probably because I did not copy the mentioned files
>>> in
>>> > the respective paths, which is something I would like to avoid. The
>>> full
>>> > output is
>>> >
>>> > ignoring special 'color push rgb 1 0 0'
>>> > ignoring special 'color pop'
>>> >
>>> > and it actually prints a pdf, but with no color, just in black
>>> (because is
>>> > ignoring the tex color statements).
>>> >
>>> > What is the solution for this problem? To be honest I don't even
>>> understand
>>> > what the problem is.
>>> >
>>> > thanks a lot,
>>> > Jose Miotto
>>> >
>>> >
>>> >
>>> > ------------------------------------------------------------
>>> ------------------
>>> > Check out the vibrant tech community on one of the world's most
>>> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>> >
>>> >
>>> >
>>> > _______________________________________________
>>> > PyX-user mailing list
>>> > [email protected]
>>> > https://lists.sourceforge.net/lists/listinfo/pyx-user
>>> >
>>>
>>> ------------------------------------------------------------
>>> ------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>> _______________________________________________
>>> PyX-user mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/pyx-user
>>>
>>
>>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to