7

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

doncherry
  • 54,637
gstat
  • 321
  • 1
  • 2
  • 6

1 Answers1

16

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

  • 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
  • 2
    @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{}. 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
  • @gstat Switching languages requires also switching the hyphenation rules. So I don't see many advantages in the possibility of changing languages without issuing proper commands for hyphenation, but rather the contrary. – egreg Apr 19 '12 at 22:23
  • @gstat I extended my answer a bit to address these issues. Basically, if you're on a 16bit system like xetex or luatex you're safe. Otherwise you need a font encoding supporting english and greek, but you can still use unicode for input. I hacked in the math stuff, but I don't know whether this is the proper way. The \mathcode definitions of greektex don't seem to work after \DeclareInputText. – Stephan Lehmke Apr 19 '12 at 22:23
  • @egreg I don't think greektex does support english hyphenation. But as with Chinese, it seems there is often a need to sprinkle in some latin words (say, brand names or units) in real world greek texts. – Stephan Lehmke Apr 19 '12 at 22:26
  • @Stephan Lemmke: The purpose of greektex is exactly to be able to write mixed documents in english and greek without issuing commands, so, I suspect it supports english hyphenation – gstat Apr 19 '12 at 22:42
  • @gstat Ok, this is achieved by simultaneously loading the greek hyphenation patterns gehyphw.gr and the american ushyph.tex. As both refer to completely different character sets in the encoding, they don't conflict. The same would work with QS7 encoding, of course. – Stephan Lehmke Apr 19 '12 at 22:51
  • @Stephan Lemke: Can you please elaborate how exactly I could make it work with QS7? – gstat Apr 19 '12 at 22:53
  • @gstat Well it's an encoding which is probably very similar to the (unknown) encoding used by greektex for its font: The lower 128 characters are identical with T1, the upper 128 roughly correspond to iso-8859-7 (but not completely, as lower case characters have to be in specific positions to avoid conflicts with other encodings). There exist qs7.enc and qs7enc.def files and hyphenation patterns for this encoding, so by copying everything in the right place and making a font with this encoding, the "font part" would be set up. – Stephan Lehmke Apr 19 '12 at 22:59
  • There are probably some issues as I didn't bother to assign proper \uccode and \lccode values, but this could be fixed I assume. – Stephan Lehmke Apr 19 '12 at 23:01