2

Using ltablex.sty I need a multipage-table with columns in (polutoniko)greek, so I use >{\selectlanguage{greek}}X in the preamble of the column (I tried it with >{begin{otherlanguage}{greek}}X<{\end{otherlanguage}}, which makes no difference).

LaTeX breaks as soon as the Greek text extends to more than one line, i.e. it works with single words, but not with sentences, whereas it works everywhere else in the long (original) document.

.log'ix says:

(/usr/local/texlive/2014/texmf-dist/tex/latex/gfsporson/lgrporson.fd)
! TeX capacity exceeded, sorry [grouping levels=255].
\UseTextSymbol #1#2->\hmode@start@before@group {
                                                \def \@wrong@font@char {\Mes...
l.53   \end{tabularx}
If you really absolutely need more capacity,
you can ask a wizard to enlarge me.

\documentclass[ngerman]{scrbook}
\usepackage{savesym}
\usepackage[LGR,T1]{fontenc}
\usepackage[utf8]{inputenc}
\input{ix-utf8enc.dfu}
\usepackage[math=normal,main=ngerman,greek,]{babel}
\usepackage{teubner}
\savesymbol{breve}
\savesymbol{aa}
\usepackage[osf,sc]{mathpazo}
\restoresymbol{pplj}{breve}
\restoresymbol{pplj}{aa}
\ifFamily{pplj}{porson}
\usepackage{array}
\usepackage{booktabs}
\usepackage{calc}
\usepackage{ltablex}
\usepackage{ragged2e}
\usepackage{soulutf8}
\tracingstats=1
\tracinggroups=1
\newcommand{\hrsp}{\ifmmode\mskip1mu\else\kern0.08em\fi}
\languageattribute{greek}{polutoniko}
\begin{document}
some thing outside the table

\begin{tabularx}{1\linewidth}{l|l|l|>{\selectlanguage{polutonikogreek}}X|>{\selectlanguage{polutonikogreek}}X|X}
Thema&\emph{Phaidros}&\emph{Symposion}&\multicolumn{1}{l}{\textlatin{\emph{Phaidros}-Stelle}}&\multicolumn{1}{l}{\textlatin{\emph{Symposion}-Stelle}}&\emph{la
    difference}\\\midrule
     \endfirsthead
    Thema&\emph{Phaidros}&\emph{Symposion}&\multicolumn{1}{l}{\textlatin{\emph{Phaidros}-Stelle}}&\multicolumn{1}{l}{\textlatin{\emph{Symposion}-Stelle}}&\emph{la
    difference}\\\midrule
     \endhead
    &237 c&194 e, 199 b--c, 201 d--e, 204 e&περὶ δ''αὖ μέθας
    τυραννεύσασα, τὸν κεκτημένον ταύτῃ ἄγουσα, δῆλον οὗ τεύξεται
    προσρήματος.&&\\
    &237\hrsp d&199\hrsp d und e, 200\hrsp a und e, 201\hrsp a,
    205\hrsp a--d, 206\hrsp b--209\hrsp e&ktl.&ktl.&etc.\\
    &239\hrsp b&183\hrsp a&&&\\
    &240\hrsp a&192\hrsp b&&&\\
    &240\hrsp e&183\hrsp b--c&&&\\
  \end{tabularx}

\end{document}
  • Doesn't work either -- at least not in the preamble of the table. I replaced >{\selectlanguage{greek}}X| with >{\greektext}X|` or \greektext{}, the results are the same. It works inside the column, but that's what I didn't want. – Alexander Wittmann Feb 23 '15 at 19:52
2

The main problem is bad interaction with tabularx: stating \selectlanguage{polutonikogreek} in the prefix to an X column causes errors that are amplified by teubner; but without it the problem is still present causing \textpi to be considered undefined.

A temporary workaround might be delaying the language setting when the paragraph is started:

\documentclass[ngerman]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\input{ix-utf8enc.dfu}
\usepackage[math=normal,main=ngerman,greek,]{babel}
\languageattribute{greek}{polutoniko}

\usepackage{savesym}
\usepackage{teubner}
\savesymbol{breve}
\savesymbol{aa}
\usepackage[osf,sc]{mathpazo}
\restoresymbol{pplj}{breve}
\restoresymbol{pplj}{aa}
\ifFamily{pplj}{porson}
\usepackage{array}
\usepackage{booktabs}
\usepackage{calc}
\usepackage{tabularx}
\usepackage{ltablex}
\usepackage{ragged2e}
\usepackage{soulutf8}

\newcommand{\Xgreektext}{%
  \everypar\expandafter{\the\everypar\csname otherlanguage*\endcsname{polutonikogreek}}%
}
\newcommand{\hrsp}{?}

\begin{document}
some thing outside the table

\begin{tabularx}{1\linewidth}{
  l|
  l|
  X|
  >{\Xgreektext\relax}X|
  >{\Xgreektext\relax}X|
  X
}
Thema&
  \emph{Phaidros}&
  \emph{Symposion}&
  \multicolumn{1}{l|}{\textlatin{\emph{Phaidros}-Stelle}}&
  \multicolumn{1}{l|}{\textlatin{\emph{Symposion}-Stelle}}&
  \emph{la difference}\\
\midrule
\endfirsthead
Thema&
  \emph{Phaidros}&
  \emph{Symposion}&
  \multicolumn{1}{l|}{\textlatin{\emph{Phaidros}-Stelle}}&
  \multicolumn{1}{l|}{\textlatin{\emph{Symposion}-Stelle}}&
  \emph{la difference}\\
\midrule
\endhead
    &237 c&194 e, 199 b--c, 201 d--e, 204 e&
περὶ δ''αὖ μέθας
    τυραννεύσασα, τὸν κεκτημένον ταύτῃ ἄγουσα, δῆλον οὗ τεύξεται
    προσρήματος.&&\\
    &237\hrsp d&199\hrsp d und e, 200\hrsp a und e, 201\hrsp a,
    205\hrsp a--d, 206\hrsp b--209\hrsp e&ktl.&ktl.&etc.\\
    &239\hrsp b&183\hrsp a&&&\\
    &240\hrsp a&192\hrsp b&&&\\
    &240\hrsp e&183\hrsp b--c&&&\\
  \end{tabularx}

\end{document}

(Note: the definition of \hrsp wasn't given.)

enter image description here

  • Sorry, \hrsp is hairspace. I forgot to remove it. – Alexander Wittmann Feb 23 '15 at 21:19
  • @AlexanderWittmann I'm afraid that either you do the way I suggested (that can have side effects), or start the Greek cells with \relax. David's patch will definitely break Greek in captions or section titles, if you want the table of contents or the list of tables/figures. – egreg Feb 23 '15 at 22:50
  • 1
    @AlexanderWittmann It's a problem due to how TeX scans tabular material, so I don't think tabu can do something about it. – egreg Feb 24 '15 at 11:50
  • Now, if I use tabu instead? Remove ltablex and add \usepackage{linegoal,longtable} and \usepackage[linegoal]{tabu}. Same table, preamble changes to \begin{longtabu} to1\linewidth{X[1,L]|X[1,L]|X[1,L]|X[2,L,\selectlanguage{polutonikogreek}]|X[2,L,\selectlanguage{polutonikogreek}]|X[1,L]}. .log: ! Missing number, treated as zero. and Runaway argument? ! Paragraph ended before \LT@max@sel was complete. + ` Paragraph ended before \LT@entry was complete.` + ! Argument of \LT@max@sel has an extra }. If the solution isn't doomed to fail from the beginning. – Alexander Wittmann Feb 24 '15 at 12:06
2

You can make the utf8 handling more robust:

\documentclass[ngerman]{scrbook}
\usepackage{savesym}
\usepackage[LGR,T1]{fontenc}
\usepackage[utf8]{inputenc}
\input{ix-utf8enc.dfu}
\usepackage[math=normal,main=ngerman,greek,]{babel}
\usepackage{teubner}
\savesymbol{breve}
\savesymbol{aa}
\usepackage[osf,sc]{mathpazo}
\restoresymbol{pplj}{breve}
\restoresymbol{pplj}{aa}
\ifFamily{pplj}{porson}
\usepackage{array}
\usepackage{booktabs}
\usepackage{calc}
\usepackage{ltablex}\keepXColumns
\usepackage{ragged2e}
\usepackage{soulutf8}
\tracingstats=1
\tracinggroups=1
\languageattribute{greek}{polutoniko}


\makeatletter
\let\zzz\UTFviii@two@octets
\protected\def\UTFviii@two@octets{\zzz}
\makeatother

\begin{document}
some thing outside the table


\begin{tabularx}{1\linewidth}{l|l|l|
>{\selectlanguage{polutonikogreek}}X|
>{\selectlanguage{polutonikogreek}}X|X}
    &237 c&194 e, 199 b--c, 201 d--e, 204 e&περὶ δ''αὖ μέθας
  \end{tabularx}

\end{document}
  • This breaks Greek in section titles if \tableofcontents is used. – egreg Feb 23 '15 at 22:47
  • @egreg yes. Still it's probably the core of a solution, just needs to be made a bit safer. somehow.... – David Carlisle Feb 23 '15 at 22:52
0

@egreg, @David-Carlisle: One can get it work. With xetex and tabu it actually works. The magic thing is >{\hspace{0pt}\selectlanguage{greek}}. For unknown reasons LaTeX needs \hspace{0pt}, else you get problems with \selectlanguage{greek} and/or the line is 1/2 half line lower.


\documentclass[german]{scrbook}
\usepackage{array}
\usepackage{booktabs}
\usepackage{calc}
\usepackage{fontspec}
\setmainfont{texgyrepagella-regular}
\setsansfont{texgyreheros-regular}
\newfontfamily\greekfont[Script=Greek,Ligatures=TeX,Scale=MatchUppercase]{GFS
  Porson}
\usepackage{polyglossia}
\setmainlanguage[latesthyphen=true,babelshorthands=true]{german}
\setotherlanguage[variant={polytonic,ancient}]{greek}
\usepackage{linegoal}
\usepackage{longtable}
\usepackage{ragged2e}
\usepackage[figuresright]{rotating}
\usepackage[linegoal]{tabu}
\begin{document}
\begin{sidewaystable}
some thing outside the table

\begin{longtabu} to1\linewidth{X[1,L]|X[1.2,L]|X[1.2,L]|>{\hspace{0pt}\selectlanguage{greek}}X[4]|>{\hspace{0pt}\selectlanguage{greek}}X[4]|X}
\rowfont[L]{\hspace{0pt}\selectlanguage{german}}Thema&\emph{Phaidros}&\emph{Symposion}&\emph{Phaidros}-Stelle&\emph{Symposion}-Stelle&\emph{la
    difference}\\\midrule
     \endfirsthead
    \rowfont[L]{\hspace{0pt}\selectlanguage{german}}Thema&\emph{Phaidros}&\emph{Symposion}&\emph{Phaidros}-Stelle&\emph{Symposion}-Stelle&\emph{la
    difference}\\\midrule
     \endhead
    &237 c&194 e, 199 b--c, 201 d--e, 204 e& περὶ δ'\,αὖ
    μέθας τυραννεύσασα, τὸν κεκτημένον ταύτῃ ἄγουσα, δῆλον οὗ τεύξεται
    προσρήματος.&&\\
    &237\hrsp d&199\hrsp d und e, 200\hrsp a und e, 201\hrsp a,
    205\hrsp a--d, 206\hrsp b--209\hrsp e&ktl.&ktl.&etc.\\
    &239\hrsp b&183\hrsp a&&&\\
    &240\hrsp a&192\hrsp b&&&\\
    &240\hrsp e&183\hrsp b--c&&&\\
    &242\hrsp d&202\hrsp d&&&\\
  \end{longtabu}
\end{sidewaystable}
\end{document}

xetexify it, you get a nice table. The thing which I neither understand nor like: With tables like this, TeX alway complains (several times, probably one complaint per line):

  See the LaTeX manual or LaTeX Companion for explanation.
  Type  H <return>  for immediate help.
  ...                                              

  l.86   \end{longtabu}


  ! LaTeX Error: Command \rmfamily invalid in math mode.`

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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