[Tex/LaTex] How to use lipsum with greek as main language

greeklanguageslipsum

I'm trying to create a random text using lipsum having greek as the main language.
The problem is that when I try to compile my file, an error keeps occuring about endcsname.

My code is

\documentclass[a4paper,11pt]{article}

\usepackage[english,greek]{babel}
\usepackage[iso-8859-7]{inputenc}
\usepackage{kerkis}
\usepackage{lipsum}    

\newcommand{\eng}[1]{\latintext#1\greektext}

\begin{document}   
\lipsum[2]
\end{document}

I also tried to run it using \eng{\lipsum[2]} instead of \lipsum[2] but it didn't seem to work. The only way to make it work is to have english as the main language.

Is there a way to solve that?

Best Answer

The lipsum package uses \roman{lips@count} to build a control sequence name; but the Greek module for babel changes the meaning of \roman making it not fully expandable.

Solution: patch the relevant command:

\documentclass[a4paper,11pt]{article}

\usepackage[english,greek]{babel}
\usepackage{kerkis}
\usepackage{lipsum}
\usepackage{etoolbox}

\makeatletter
\patchcmd\lips@dolipsum
 {\roman{lips@count}}
 {\romannumeral\c@lips@count}
 {}{}
\makeatother

\begin{document}
\lipsum[2]
\end{document}

I've omitted the call to inputenc that's not relevant for the example. You should consider switching to UTF-8 rather than using ISO-8859-7.

Related Question