[Tex/LaTex] Greek pdf-bookmarks with greektex package; is it possible

greekhyperreftexlive

I am using TeX Live and also, package greektex. In order for greektex to work I must use iso-8859-7 encoding. I was wondering if with these settings there is a way to produce pdf bookmarks in Greek (and if possible to also use hyperref).

\documentclass[10pt]{book}
\usepackage{greektex}
\usepackage[bookmarks=true]{hyperref}
\begin{document}
   \chapter{κεφαλαιο}
\end{document}

If one runs the above code the pdf bookmark that is produced is not in greek

Best Answer

I think the amount of work needed wouldn't warrant the advantages of using greektex at all. May I ask what exactly you're using it for?

If I'm reading this correctly, it's a package which breaks exactly everything LaTeX is doing nowadays in the inputenc/fontenc area.

The goal of greektex is to support a set of fonts called ywclr which are, AFAICS, only available as metafont sources. So one of the tasks of lifting this into the current century would probably be to apply mftrace or the like ;-)

The "input encoding" iso-8859-7 is supported by the package, but by directly mapping the input characters to the encoding of the fonts. There is a font encoding LG1 defined in the package but it doesn't really do anything of interest, in particular it's not defining the greek characters, so you can't use it to install any other appropriate font in this encoding.

Now, what would you need to get bookmarks?

First of all,

\usepackage[unicode]{hyperref}

is really the only option as the encoding PD1 used by hyperref otherwise doesn't support greek. Note that these are font encodings, this doesn't mean the input has to be unicode!

The encoding PU used by hyperref for the unicode option does support greek as follows:

\DeclareTextCommand{\textalpha}{PU}{\83\261}% U+03B1
\DeclareTextCommand{\textbeta}{PU}{\83\262}% U+03B2
\DeclareTextCommand{\textgamma}{PU}{\83\263}% U+03B3

Which means, to work with hyperref at all, your greek characters have to be encoded as \textalpha \textbeta \textgamma on the input level!

Basically, you'd need an input encoding mapping iso-8859-7 input to these definitions like this:

\DeclareInputText{"E1}{\textalpha}
\DeclareInputText{"E2}{\textbeta}
\DeclareInputText{"E3}{\textgamma}

Such an input encoding doesn't exist at the time being, and considering everybody is switching to unicode nowadays, there probably never will.

To get back to your fonts, you'd then need a font encoding mapping these characters back to the correct positions in the font.

This will probably break a lot of things in the greektex package...

Just to show that something like this can work at all, I made the following example:

\documentclass{article}

\usepackage[latin1]{inputenc}

\DeclareInputText{`α}{\ifmmode\alpha\else\textalpha\fi}
\DeclareInputText{`β}{\ifmmode\beta\else\textbeta\fi}
\DeclareInputText{`γ}{\ifmmode\gamma\else\textgamma\fi}

\pdfmapfile{+frutigernext.map}

\renewcommand\rmdefault{frutigernext}


\usepackage[QS7]{fontenc}
\usepackage[unicode]{hyperref}

\begin{document}

\section{abc αβγ}

\[α=β^2\]

\end{document}

greek example

Note that this is not a working example as I have the neccessary encoding and font installation here on my system. QS7 however is a font encoding I made myself which is probably very near to what you need as it is also based on iso-8859-7. I only haven't made an input encoding for iso-8859-7 as I'm really working with Unicode (in an XML-based system), so for the example I used a little bit of hacking :-)

Conclusion

As a conclusion, I strongly urge you to switch to unicode and use a different font, as suggested in greek pdf bookmarks.

If you are on a system like xetex or luatex supporting 16+bit encodings, all is well :-)

In greek pdf bookmarks you'll see a lot of examples based on unicode input and LGR font encoding however, which is problematic if you want to mix latin and greek characters. So I can recommend my QS7 font encoding ;-)

Here's an example for a real world use of mixing greek and latin script. The text comes from a unicode-encoded database, no real chance to switch languages here.

greek+latin text