# Greek pdf-bookmarks with greektex package; is it possible?

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

-
possible duplicate of Greek pdf bookmarks –  Marco Daniel Apr 19 '12 at 18:02
it is not a duplicate the difference is the greektex package –  gstat Apr 19 '12 at 18:04
Unfortunately the greektex package wants to load fonts that are not in TeX Live and the documentation is only in Greek. However, I don't think that the example can run as it is: what input encoding are you using? Surely greektex is not compatible with UTF-8. –  egreg Apr 19 '12 at 20:18
@egreg: no the input must be in iso-8859-7 in order to produce readable output –  gstat Apr 19 '12 at 20:34
@gstat As far as I know there's no LaTeX support for this input encoding. –  egreg Apr 19 '12 at 20:50

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}


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.

-
Great answer, Stephan. –  egreg Apr 19 '12 at 21:32
Edit: Incorporated input encoding for three characters ;-) –  Stephan Lehmke Apr 19 '12 at 21:44
@Stephan Lehmke: First, thank you for your answer. The thing is that using package greektex is very handy when it comes to using greek in a document since you don't have to issue any commands in order to switch from english to greek and vice versa. Anyway I will ponder on your answer, thanks again. –  gstat Apr 19 '12 at 21:52
@gstat The same holds if you use unicode as input encoding! –  Stephan Lehmke Apr 19 '12 at 21:54
@Stephan Lemke: I thought that if you use unicode you have to use something like babel and everytime issue a command like \selectlanguage{<language>}. Also greektex makes it possible to use greek letters in mathmode for example $α$ is the same with $\alpha$ –  gstat Apr 19 '12 at 21:59