Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nbconvert: Latex to PDF conversion fails on notebooks with accented letters #4539

Closed
dpsanders opened this issue Nov 14, 2013 · 7 comments
Closed
Milestone

Comments

@dpsanders
Copy link
Contributor

In Spanish (for example), it is often necessary to include accented letters in notebook titles for grammatical correctness.

However, creating a notebook with the title "Análisis", for example (the first word of the title I was trying to use) fails in the conversion to PDF stage; this is apparently a Unicode problem in pdflatex (the LaTeX output is produced without problems):

012/texmf-dist/tex/latex/ucs/ucsencs.def)

Package ucs Warning: ***************************
(ucs)                You seem to have loaded inputencoding utf8
(ucs)                (LaTeX kernel UTF-8) instead of utf8x (ucs.sty UTF-8).
(ucs)                Probably you are compiling a document written for a
(ucs)                pre-august-2004 ucs.sty.
(ucs)                ***************************
(ucs)                Please use \usepackage[utf8x]{inputenc} instead of
(ucs)                \usepackage[utf8]{inputenc}.
(ucs)                ***************************
(ucs)                If you should really want to use ucs.sty and kernel's
(ucs)                utf8.def together, use \usepackage[utf8x,utf8]{inputenc}
(ucs)                to disable compatibility mode
(ucs)                ***************************
(ucs)                Activating compatibility mode.
(ucs)                ***************************
(ucs)                 on input line 218.

(/usr/local/texlive/2012/texmf-dist/tex/latex/ucs/utf8x.def)
(/usr/local/texlive/2012/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/local/texlive/2012/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(./Análisis.out) (./Análisis.out)
(/usr/local/texlive/2012/texmf-dist/tex/latex/ucs/data/uni-3.def)

! Package ucs Error: Please activate option 'combine'.

See the ucs package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.222 
@jakobgager
Copy link
Contributor

Have you tried using utf8x instead of utf8 and the option combine as suggested by this latex error?

@dpsanders
Copy link
Contributor Author

Hi Jakob,
Yes, it gives the following new error.

If I ignore the errors with 'r' in pdflatex, I get the title as
Ana'lisis (i.e. the accent is not correctly placed over the a).

! LaTeX Error: Option clash for package ucs.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.26     \usepackage
                    {fancyvrb} % verbatim replacement that allows latex

@jakobgager
Copy link
Contributor

OK, if I create a notebook named Latex_test_Análisis.ipynb with a heading cell like Análisis über it converts fine to .tex and this compiles without issues to pdf (using default options - no manual modification of the tex file).

If I use the --post=pdf option, I get an error, hence seems to be a unicode bug in the pdf postprocessor.
Is this the error you are facing?

@marcmolla
Copy link
Contributor

Hi,

I have the same problem with the accents in the notebook name. I created an empty notebook named Test_Análisis.ipynb and I tried to convert it by using ipython nbconvert .\Test_Análisis.ipynb. The result is the following error:

PS C:\Users\IPython notebooks> ipython nbconvert .\Test_Análisis.ipyn
b
Traceback (most recent call last):
  File "C:\Anaconda\Scripts\ipython-script.py", line 5, in <module>
    sys.exit(start_ipython())
  File "C:\Anaconda\lib\site-packages\IPython\__init__.py", line 118, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "C:\Anaconda\lib\site-packages\IPython\config\application.py", line 544, in launch_instance
    app.initialize(argv)
  File "<string>", line 2, in initialize
  File "C:\Anaconda\lib\site-packages\IPython\config\application.py", line 89, in catch_config_error
    return method(app, *args, **kwargs)
  File "C:\Anaconda\lib\site-packages\IPython\terminal\ipapp.py", line 312, in initialize
    super(TerminalIPythonApp, self).initialize(argv)
  File "<string>", line 2, in initialize
  File "C:\Anaconda\lib\site-packages\IPython\config\application.py", line 89, in catch_config_error
    return method(app, *args, **kwargs)
  File "C:\Anaconda\lib\site-packages\IPython\core\application.py", line 362, in initialize
    self.parse_command_line(argv)
  File "C:\Anaconda\lib\site-packages\IPython\terminal\ipapp.py", line 307, in parse_command_line
    return super(TerminalIPythonApp, self).parse_command_line(argv)
  File "<string>", line 2, in parse_command_line
  File "C:\Anaconda\lib\site-packages\IPython\config\application.py", line 89, in catch_config_error
    return method(app, *args, **kwargs)
  File "C:\Anaconda\lib\site-packages\IPython\config\application.py", line 463, in parse_command_line
    self.argv = list(argv)
  File "C:\Anaconda\lib\site-packages\IPython\utils\traitlets.py", line 315, in __set__
    new_value = self._validate(obj, value)
  File "C:\Anaconda\lib\site-packages\IPython\utils\traitlets.py", line 323, in _validate
    return self.validate(obj, value)
  File "C:\Anaconda\lib\site-packages\IPython\utils\traitlets.py", line 1215, in validate
    value = self.validate_elements(obj, value)
  File "C:\Anaconda\lib\site-packages\IPython\utils\traitlets.py", line 1291, in validate_elements
    return super(List, self).validate_elements(obj, value)
  File "C:\Anaconda\lib\site-packages\IPython\utils\traitlets.py", line 1225, in validate_elements
    v = self._trait.validate(obj, v)
  File "C:\Anaconda\lib\site-packages\IPython\utils\traitlets.py", line 1028, in validate
    return unicode(value)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe1 in position 9: ordinal not in range(128)

I am working on a 64-bits windows 7 machine with the following versions:

PS C:\Users\IPython notebooks> ipython --version
1.1.0

PS C:\Users\IPython notebooks> python --version
Python 2.7.5 :: Anaconda 1.7.0 (64-bit)

@marcmolla
Copy link
Contributor

Also confirmed in a Ubuntu machine. It seems that the program is reading the arguments of command-line in str, without taking into account the stdin encoding.

@marcmolla
Copy link
Contributor

My issue is solved in ipython 2.0.0 (master branch)

@minrk
Copy link
Member

minrk commented Dec 20, 2013

Thanks @marcmolla, closing then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants