如何在 ltablex 中使用 \selectlanguage?

如何在 ltablex 中使用 \selectlanguage?

使用时ltablex.sty我需要一个带有(polutoniko)希腊语列的多页表,因此我>{\selectlanguage{greek}}X在列的序言中使用(我尝试过>{begin{otherlanguage}{greek}}X<{\end{otherlanguage}},但没有什么区别)。

一旦希腊文本扩展到多行,LaTeX 就会中断,即它只能处理单个单词,而不能处理句子,然而它在长(原始)文档的其他地方都可以工作。

.log'ix 说:

(/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}

答案1

主要问题是与 的交互不佳:在 X 列的前缀中tabularx声明会导致错误,并且错误会被 放大;但如果没有它,问题仍然存在,导致被视为未定义。\selectlanguage{polutonikogreek}teubner\textpi

一个临时的解决方法可能是在段落开始时延迟语言设置:

\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}

\hrsp(注意:没有给出的定义。)

在此处输入图片描述

答案2

您可以使 utf8 处理更加健壮:

\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}

答案3

@egreg、@David-Carlisle:可以让它工作。使用xetextabu它确实有效。神奇的是>{\hspace{0pt}\selectlanguage{greek}}。由于未知原因LaTeX需要\hspace{0pt},否则您会遇到问题和\selectlanguage{greek}/或线路会降低 1/2 半线。


\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}

xetex将它化,你会得到一个漂亮的表格。我既不理解也不喜欢的事情是:对于这样的表格,TeX总是会抱怨(几次,可能每行一个抱怨):

  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.`

相关内容