Accented characters are missing on the pdf

77 views
Skip to first unread message

Jean-Patrick Pommier

unread,
Jan 2, 2014, 10:40:14 AM1/2/14
to sage-...@googlegroups.com
Happy new year to everybody,

A worksheet with some html code contains accented characters.

%html
<h2> Résolvons une équation </h2>


 When this sheet is printed to a pdf, all the accented characters are removed. For example Résolvons becomes Rsolvons.
The code was modified as follow:

%html
<h2> R&eacute;solvons une &eacute;quation </h2>

But that doesn't fix the problem.

Any idea?
thank you.


Dominique Laurain

unread,
Jan 3, 2014, 7:28:49 AM1/3/14
to sage-...@googlegroups.com

Summary and translation of text below :

I believe it will be useful to have some free language TTF fonts installed, because pdflatex can embed them into the PDF file when translatating SAGE tex file.

*****************

Bonjour Jean-Pierre,

Pour les rubriques %html ou %md (markdown langage), je ne saurai répondre à ta question, mais c'est plus facile pour un fichier format TeX.

SAGE cloud utilise le package pdflatex sur la machine virtuelle sous Ubuntu.
Voir a ce sujet: http://planet.sagemath.org/ , August 28, 2013, William Stein, LaTeX in the Cloud
ou https://groups.google.com/forum/#!msg/sage-cloud/yfLQM8_D-W8/ET0PxyNM6-cJ

pdflatex utilise lui-même les polices (fonts) installées sur le système, ici c'est Ubuntu.
Il y a de fortes chances pour qu'actuellement,il n'y ait pas de police accentuées
Par contre elles sont bien incluses (embedded) dans le PDF: télécharger par exemple sous http://wstein.org/rh/ le document modèle de W.Stein
et faire Propriétés sous explorateur Fichiers pout voir les polices incluses

Essayer : pdffonts dans une fenêtre Terminal pour lister les polices installées

Je ne sais pas si il est possible d'installer des polices localement (sous Terminal, dans un répertoire utilisateur machine virtuelle). Il serait alors
théoriquement (je n'ai pas essayé..nécessite du temps de mise au point) possible de générer un PDF en posiitonnant au préalable une des variables
d'environnement Linux comme TFMFONTS, MFINPUTS, VFFONTS et PKFONTS

Il y a des URL Internet intéressantes sur le sujet comme:
http://tex.stackexchange.com/questions/10391/how-to-embed-fonts-at-compile-time-with-pdflatex
http://askubuntu.com/questions/50274/fonts-are-not-embedded-into-a-pdf
http://starlinq.livejournal.com/3396.html
http://tex.stackexchange.com/questions/34203/where-to-put-sty-and-cls-file-for-project
https://groups.google.com/forum/#!msg/sage-cloud/yfLQM8_D-W8/ET0PxyNM6-cJ
...
meme si le mieux, serait que des polices TTF libres de droit soient installées pour tous les utilisateurs

Dominique


Dominique Laurain

unread,
Jan 3, 2014, 7:30:46 AM1/3/14
to sage-...@googlegroups.com
Désolé, c'est Jean-Patrick

Jean-Patrick Pommier

unread,
Jan 3, 2014, 7:56:00 AM1/3/14
to sage-...@googlegroups.com
Hi,
When you suggest to use the terminal or to install fonts, I suppose you mean within the sage environnement.
If I type in a terminal of the sage project, I get:
~$ pdffonts
pdffonts version 0.18.4
Copyright 2005-2011 The Poppler Developers - http://poppler.freedesktop.org
Copyright 1996-2004 Glyph & Cog, LLC
Usage: pdffonts [options] <PDF-file>
  -f <int>       : first page to examine
  -l <int>       : last page to examine
  -opw <string>  : owner password (for encrypted files)
  -upw <string>  : user password (for encrypted files)
  -v             : print copyright and version info
  -h             : print usage information
  -help          : print usage information
  --help         : print usage information
  -?             : print usage information
Does that mean that there's no additional fonts ...

Thank you anyway

Jean-Pat

PS: But you are french!

William Stein

unread,
Jan 3, 2014, 1:18:20 PM1/3/14
to sage-...@googlegroups.com, Cedric Sodhi
This is just a matter of improving the unicode support of the script
~/.sagemathcloud/sagews2pdf.py

Cedric Sodhi actually just did a bunch of work on this and sent me an
updated script, but I have been
really busy with some backend changes, so haven't had a chance to release it.

I've attached it to this email if you want to give it a try and see if
it works for you. I should release it soon
officially.

>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-cloud" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-cloud+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-cloud/221b74da-ce38-4f91-ab14-7a3b464066cb%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.



--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org
sagews2pdf.py

Pedro A. Tonelli

unread,
Jan 3, 2014, 4:50:55 PM1/3/14
to sage-...@googlegroups.com
Hi,


2014/1/3 William Stein <wst...@gmail.com>

On Thu, Jan 2, 2014 at 5:40 AM, Jean-Patrick Pommier
<jeanpatri...@gmail.com> wrote:
> Happy new year to everybody,
>
> A worksheet with some html code contains accented characters.
>
> %html
> <h2> Résolvons une équation </h2>
>
>
>  When this sheet is printed to a pdf, all the accented characters are
> removed. For example Résolvons becomes Rsolvons.
> The code was modified as follow:
>
> %html
> <h2> R&eacute;solvons une &eacute;quation </h2>
>
> But that doesn't fix the problem.
>
> Any idea?
> thank you.

This is just a matter of improving the unicode support of the script
~/.sagemathcloud/sagews2pdf.py

Cedric Sodhi actually just did a bunch of work on this and sent me an
updated script, but I have been
really busy with some backend changes, so haven't had a chance to release it.

I've attached it to this email if you want to give it a try and see if
it works for you.   I should release it soon
officially.


It didn't solve the problem mentioned by Jean-Patrick. On the other hand if you edit the latex_preamble
in the file sagews2pdf.py just adding a line "\usepackage[utf8]{inputenc}" (after \usepackage{amsmath} ) the correct caracters appears in the PDF generated by the print button.


--
-- Pedro Aladar Tonelli --

Dominique Laurain

unread,
Jan 4, 2014, 11:05:49 AM1/4/14
to sage-...@googlegroups.com
in the file sagews2pdf.py just adding a line "\usepackage[utf8]{inputenc}" (after \usepackage{amsmath} ) the correct caracters appears in the PDF generated by the print button.
-- Pedro Aladar Tonelli --

Agree with P.A.Tonelli: that line is mandatory.
I uploaded W.Stein's python file in ~/.samemathcloud, convert it from DOS file format to Linux file format (using tr command to delete Ctrl-M at end of lines), changed execution modes (chmod +ug) and  produced PDF on sagews tex file (using print preview icon).
Accents are included now in PDF.

Need more tests...but one good package improvement.

The LaTeX translation of ascii unicodes is new for me.
I need to reed more (eg  http://en.wikibooks.org/wiki/LaTeX/Fonts#Font_encoding) .... :-)

PS: yes, I am french..(nobody is perfect ;-)  )

William Stein

unread,
Jan 4, 2014, 12:37:04 PM1/4/14
to sage-...@googlegroups.com
On Sat, Jan 4, 2014 at 6:05 AM, Dominique Laurain
<dominique...@orange.fr> wrote:
>
>> in the file sagews2pdf.py just adding a line "\usepackage[utf8]{inputenc}"
>> (after \usepackage{amsmath} ) the correct caracters appears in the PDF
>> generated by the print button.
>> -- Pedro Aladar Tonelli --
>
>
> Agree with P.A.Tonelli: that line is mandatory.
> I uploaded W.Stein's python file in ~/.samemathcloud, convert it from DOS
> file format to Linux file format (using tr command to delete Ctrl-M at end
> of lines), changed execution modes (chmod +ug) and produced PDF on sagews
> tex file (using print preview icon).
> Accents are included now in PDF.
>
> Need more tests...but one good package improvement.

Thanks for your test -- this will be *standard* in projects soon (later today).

William

>
> The LaTeX translation of ascii unicodes is new for me.
> I need to reed more (eg
> http://en.wikibooks.org/wiki/LaTeX/Fonts#Font_encoding) .... :-)
>
> PS: yes, I am french..(nobody is perfect ;-) )
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-cloud" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-cloud+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-cloud/2f62c7fa-b962-4e1f-a9f2-bf6b8a7f0276%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages