# [tex-eplain] accents problem in pdf generated by eplain

Laurence Finston Laurence.Finston at gmx.de
Sat Jan 22 18:38:47 CET 2022

> I confirm it recognizes accented letters, so one may wonder why the other viewers do not.

The other viewers recognize accented letters, they just don't recognize two glyphs, where the one for the accent is superimposed on the one for the letter.  I'm more surprised that evince does recognize this.

TeX installations generally (always?) use Computer Modern as the default font.  People often use other fonts and European Computer Modern was designed to look like CM.  If, however, you don't want to switch over to European Computer Modern entirely, you can define your accented characters like this:

\font\ecrm=ecrm1000
\def\aacute{{\ecrm\char<whatever>}}
\def\eacute{{\ecrm\char<whatever>}}
etc.

For the character codes, see the table for ecrm I sent you previously.   You can specify them in the definitions above in octal like this: '10 or in hexadecimal like this: "A.

You could try defining á, é, etc. as active characters, but this didn't work on my computer.

\catcode233=\active
\defé{{\ecrm\char<whatever>}}

The problem seems to lie with TeX or with shell:  In my editor, é is an ASCII character (one byte) but TeX interprets it as a two bytes.  However,
\accute, \eacute should be sufficient.

> Do you see something that I could modify to get things correct without modifying the page display?

Sorry, that's too much to look through.

Gesendet: Samstag, 22. Januar 2022 um 18:08 Uhr
Von: "Gérald Tenenbaum" <gerald.ten at free.fr>
An: "Laurence Finston" <Laurence.Finston at gmx.de>
Cc: "GT-Free" <gerald.ten at free.fr>
Betreff: Re: [tex-eplain] accents problem in pdf generated by eplain
I eventually succeeded in installing evince. I confirm it recognizes accented letters, so one may wonder why the other viewers do not.
I believe my TeX installation does use cmr fonts. I append my main input files for the book. Do you see something that I could modify to get things correct without modifying the page display?

Laurence Finston a écrit le 22/01/2022 à 17:46 :

>> but the command "evince xxx.pdf" does nothing.

I don't know the reason for this.  Maybe this doesn't open a window on a Mac.

> Do you think there is a chance that if a pdf is re-saved with evince, then the accents will be embedded?

No.  evince will not replace any glyphs.  If you want á, é, etc., to be displayed reliably on all PDF viewers, then I think the best (only?) solution is to use a font which has individual characters for these glyphs, such as European Computer Modern.  I also don't see any disadvantage in doing this.

Gesendet: Samstag, 22. Januar 2022 um 15:11 Uhr
Von: "Gérald Tenenbaum" <gerald.ten at free.fr>
An: "Laurence Finston" <Laurence.Finston at gmx.de>
Betreff: Re: [tex-eplain] accents problem in pdf generated by eplain
This of course what I did. I apparently installed Xcode, command lines, and evince, but the command "evince xxx.pdf" does nothing.
Do you think there is a chance that if a pdf is re-saved with evince, then the accents will be embedded?
Regards,

Gérald

Laurence Finston a écrit le 22/01/2022 à 11:51 :

To the best of my knowledge, there is a program corresponding to a shell or terminal emulator on Macs.  I once used one for a brief period and I'm pretty sure I was able to call programs from the command line.  Again, to the best of my knowledge, MacOS is a variety of Unix, so things that work on GNU/Linux should often work on MacOS.

If you need help with this, I suggest you try the internet forums and/or mailing lists for Mac and evince.

Gesendet: Samstag, 22. Januar 2022 um 11:38 Uhr
Von: "Gérald Tenenbaum" <gerald.ten at free.fr>
An: "Laurence Finston" <Laurence.Finston at gmx.de>
Betreff: Re: Aw: Re: Re: [tex-eplain] accents problem in pdf generated by eplain
Thanks.
Nothing similar on my mac. I looked everywhere but it's probably well hidden. I give up.
Regards,

Gérald

Laurence Finston a écrit le 22/01/2022 à 05:39 :

On my Ubuntu (GNU/Linux) system, there is an icon among my "Favorites".  The package calls itself "Document Viewer".  The name of the executable, however, is "evince".  I just call "evince <filename>" from a shell, or more often, "evince <filename> &" to make it a background process.  See attached screenshot.  The icon is the seventh from the top at the left side, with the pair of glasses.

Gesendet: Samstag, 22. Januar 2022 um 04:39 Uhr
Von: "Gérald Tenenbaum" <gerald.ten at free.fr>
An: "Laurence Finston" <Laurence.Finston at gmx.de>
Betreff: Re: Aw: Re: [tex-eplain] accents problem in pdf generated by eplain
Hello Laurence,

I followed the steps to install evince on my mac. It apparently went through but how do you launch it?
Regards,

Gérald

Laurence Finston a écrit le 21/01/2022 à 04:16 :

This is the contents of dtemp.tex:

\input eplain

\font\rm=ecrm1000
\rm
th{\char233}orie

\bye

These are the commands run:

tex dtemp && dvips -o dtemp.ps dtemp.dvi && ps2pdf dtemp.ps

The results are in the attached screenshots.  In evince, both {\'e} and é are searchable with é.  However, strangely, the orange box only covers half of the é resulting from {\'e}.  In Firefox, only é is searchable.

Since it obviously works, I haven't tested with pdftex, luatex, xetex ...

Gesendet: Freitag, 21. Januar 2022 um 00:46 Uhr
Von: "Karl Berry" <karl at freefriends.org>
An: gerald.ten at free.fr
Cc: tex-eplain at tug.org
Betreff: Re: [tex-eplain] accents problem in pdf generated by eplain

Hi G\'erald - there are no special facilities in Eplain to make
PDF searching work, unfortunately. So this becomes a question about
getting searchable accents in PDF produced by plain TeX.

For pdfTeX, it is the primitives \pdfgentounicode and \pdfglyphtounicode
that ultimately define how the searching works. Whether those can be
coerced into working with the default CM 7-bit fonts, as Laurence
described, I don't know, but it may be possible.  Unfortunately I have
no recipe, either for that or for using 8-bit fonts like EC.

I didn't try it, but I suspect that using xetex or luatex, and
OTF/TTF fonts (like Latin Modern), and Unicode characters for input
instead of TeX control sequences like \'e, would work.

However, to make TeX control sequences yield searchable characters in
plain TeX (with any engine), I don't know. I'm down to suggesting
posting the question on a more general forum, like the texhax at tug.org
mailing list or the tex.stackexchange.com forum, etc. Sorry. If you do,