Based on the templates/files asymTypB.lco, brieftemplate.tex, briefwbk.tex found at http://www.komascript.de/files/KOMA-Script-3-Buch-Beispielcode.zip, I derived a modified template for an invoice (initially as posted at https://tex.stackexchange.com/a/152558/8272).

Attempting to translate this into Greek (available at https://github.com/NikosAlexandris/invoice_el), I've added the following instructions, as per KOMA's guide recommendations:

\AtBeginDocument{%

\providecaptionname{greek}{\datename}{Ημερομηνία}%
\providecaptionname{greek}\subjectname{Θέμα}%

\providecaptionname{greek}\headtoname{Προς}%

\providecaptionname{greek}{\customername}{Πελάτης (Κωδικός, Αριθμός)}%
\providecaptionname{greek}\yourmailname{Εγγραφή Πελάτη}%
\providecaptionname{greek}{\yourrefname}{Διακριτικός τίτλος έργου}%

\providecaptionname{greek}\headfromname{Από}%
\providecaptionname{greek}\emailname{η-Ταχυδρομείο}%
\providecaptionname{greek}\wwwname{Url}%
\providecaptionname{greek}\phonename{Τηλέφωνο}%
\providecaptionname{greek}\faxname{Τηλεομοιότυπο}%

\providecaptionname{greek}{\myrefname}{Εσωτερική εγγραφή}%
\providecaptionname{greek}{\invoicename}{Τιμολόγιο No.}%
\providecaptionname{greek}{\bankname}{Τραπεζικός Λογαριασμός}%

\providecaptionname{greek}\ccname{cc}%
\providecaptionname{greek}\enclname{Επισυναπτόμενα}%

\providecaptionname{greek}\pagename{Σελίδα}%
}

In addition, I added new variables in the respective .lco file as explaiend in (this) KOMA's script guide (english version, page 371), a new variable accepts a pre-defined description, i.e.: newkomavar*[description ]{name }. For example,

% New variable(s) here!
\newkomavar{company}%
\newkomavar{professiona}%
\newkomavar{professionb}%
\newkomavar{fromvatin}%
\newkomavar{fromlinkedin}%

So far is all fine. However, adding a greek description for a custom variable, won't work as expected. To exemplify, the following

\newkomavar*[ΑΦΜ Πελάτη]{yourvatin}%

appears in the compiled pdf (PDFLaTeX) as ὐἇὐᾔὐῂ ὐήὐᾡὐὢὐῇὓᾲὐᾣ. How should a greek description for custom koma variables be realised (inside PDFLaTeX) from inside an .lco file?

  • Kind of a minimal working example available at github.com/NikosAlexandris/invoice_el/blob/master/… – Nikos Alexandris Jun 5 '14 at 15:04
  • I think refname and refvalue must also be declared with \newkomavar. I get "Class scrlttr2 Error: KOMA-Script variable not defined." – mvkorpel Jun 6 '14 at 19:51
  • 1
    @mvkorpel Thanks for your attention. I don't know how to deal with this. Looking at it. Anyhow, I get a PDF, despite errors and my main problem is the "Greek" description of the custom variable. I will try to fix all errors in time. Ideas on where to look are, of course, welcome. – Nikos Alexandris Jun 7 '14 at 19:41
  • 1
    I was able to compile the example without errors by applying the following changes: 1. In custom_invoice_asymTypB_el.lco, I moved \raggedright to be the last command inside the \parbox titled "Main block of Info-Column". I don't know why this helps. 2. In custom_invoice_template_el.tex, I replaced \smallskip with \smallskipamount: a length is required. 3. Also in the template file, I commented out \setkomavar lines where \includegraphics points to a non-existent file. Bonus: I moved \makeatletter down to just before \@setplength and used \makeatother to reset the change. – mvkorpel Jun 16 '14 at 14:53
  • 1
    I made a pull request on github. – mvkorpel Jun 17 '14 at 7:04
up vote 1 down vote accepted

Your example files seem to use UTF-8 encoding. The sequence of UTF-8 hex codes from the individual letters of "ΑΦΜΠελάτη" is ce91 cea6 ce9c cea0 ceb5 cebb ceac cf84 ceb7 (note: space was removed).

I am not familiar with the intricate details of Greek font encodings in LaTeX, but the table of the LGR encoding in the LaTeX font encodings manual maps the bytes of the UTF-8 sequence (ce, 91, ce, a6, ...) to the wrong output you are seeing.

A new example

As I am not able to compile your example document, I must demonstrate the issue and proposed solutions with minimal examples of my own.

First, the problem occurs when no inputenc has been defined:

\documentclass{standalone}
\usepackage[LGR]{fontenc}
\begin{document}
ΑΦΜ Πελάτη
\end{document}

picture with wrong character sequence

The problem can be solved by:

A. defining a suitable input encoding

\documentclass{standalone}
\usepackage[LGR]{fontenc}
\usepackage[utf8]{inputenc}
\begin{document}
ΑΦΜ Πελάτη
\end{document}

or

B. using character codes found in the LGR table. The mapping from "ΑΦΜΠελάτη" to decimal codes is 65, 70, 77, 80, 101, 108, 136, 116, 104.

\documentclass{standalone}
\usepackage[LGR]{fontenc}
\begin{document}
\char65\char70\char77{} \char80\char101\char108\char136\char116\char104
\end{document}

Both A and B give the same result:

picture with correct character sequence

Applying this to the original example

I guess the character code solution (B) would work as such. For the input encoding solution to work, I think you would need to move the \inputenc declaration to an earlier location in your document, before any Greek text. Note that in your example the .lco template containing \newkomavar*[ΑΦΜ Πελάτη]{yourvatin} is included straight from \documentclass, before the declaration of an \inputenc.

  • Your answer (especially the very last paragrah), lead me to an answer :-). I modified the .lco file so as to be, regarding the custom variable in question, \newkomavar*[\yourvatinname]{yourvatin} and \providecaptionname{english}\yourvatinname{Customer's VATin}. It's a step forward. – Nikos Alexandris Jun 12 '14 at 11:37
  • Appears that I wasn't persistent enough when trying to compile your example document. The current version requires 18 presses of <return> to pdflatex, but finally a pdf is produced. The previous version only requires 10 <return>s. Interesting. Every error happens on the \opening line. – mvkorpel Jun 14 '14 at 21:48
  • I will get back on this once I have some more free time. I certainly want to have a clean template, after eliminating all errors, one by one. Your invaluable time is helping me getting there. – Nikos Alexandris Jun 15 '14 at 10:20

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.