![将 longtable 与 reledmac 和 rledpar 结合使用](https://linux22.com/image/325966/%E5%B0%86%20longtable%20%E4%B8%8E%20reledmac%20%E5%92%8C%20rledpar%20%E7%BB%93%E5%90%88%E4%BD%BF%E7%94%A8.png)
我的系统是 XeTeX 版本 3.14159265-2.6-0.99992(TeX Live 2015/W32TeX)。
我正在排版《博伽梵歌》的双语版对开页。左页是原始梵语文本,后接印地语译文;右页是 IAST 音译文本,后接英语翻译。
对于对开页功能,我正在使用reledmac
和reledpar
对于对开页功能。
我还必须使用该longtable
包来处理原始诗句及其音译。这是由于两个原因:(1)梵文中诗句的传统对齐方式是文本对齐,但行尾标记和数字左对齐,因此我需要一个具有两列的表格环境(2)有时多个诗句形成一个句子(例如第一章的第 4、5 和 6 节共有六行)并且必须将它们排版在一起,因此必须在表格环境中允许分页符。此外,由于原始文本很大(700 节诗句),排版行的宽度差异很大,因此我需要具有动态宽度的长表。为此,我使用textwidth
和calc
来动态计算宽度。
因此,这就是我继续进行的方式。下面是一个有效的 MWE
\documentclass[10pt,twoside]{book}
\usepackage[dvips=false,pdftex=false,vtex=false,top=2.25cm,left=16.5mm,bottom=0.75in,right=15mm,paperwidth=138mm,paperheight=216mm]{geometry}
\usepackage{calc}
\usepackage{array}
\usepackage{longtable,ltabptch}
\usepackage{setspace}
\setlength{\LTpre}{0pt}
\setlength{\LTpost}{0pt}
\usepackage{polyglossia}
\setmainlanguage{hindi}
\setotherlanguage{english}
\setmainfont[Script=Devanagari,AutoFakeBold=2.0]{Siddhanta}
\newfontfamily\englishfont{Charis SIL}
\usepackage[series={},nocritical,noend,noeledsec,nofamiliar,noledgroup]{reledmac}
\usepackage{reledpar}
\usepackage[pdfpagelayout=TwoPageRight]{hyperref}
\begin{document}
\newlength{\mylenone}
\newlength{\mylentwo}
\newlength{\mylenthree}
\mainmatter
\doublespacing
\begin{pages}
\begin{Leftside}
\beginnumbering
\pstart
LATEX-NEEDS-SOME-TEXT-HERE
{\bfseries
\settowidth{\mylenone}{धर्मक्षेत्रे कुरुक्षेत्रे समवेता युयुत्सवः}
\settowidth{\mylentwo}{मामकाः पाण्डवाश्चैव किमकुर्वत सञ्जय}
\setlength{\mylenone}{\maxof{\mylenone}{\mylentwo}}
\setlength{\mylentwo}{\baselineskip}
\setlength{\mylenone}{\mylenone + 1pt}
\setlength{\mylenthree}{(\textwidth - \mylenone)*\real{0.5}}
\settowidth{\mylentwo}{धृतराष्ट्र उवाच}
\setlength{\mylentwo}{\mylenthree + (\mylenone - \mylentwo)*\real{0.5}}
\begin{longtable}[l]{@{\hspace*{\mylenthree}}>{\setlength\parfillskip{0pt}}p{\mylenone}@{}@{}l@{}}
\multicolumn{1}{l}{\hspace*{\mylentwo}धृतराष्ट्र उवाच} \\ \nopagebreak
धर्मक्षेत्रे कुरुक्षेत्रे समवेता युयुत्सवः & ।\\ \nopagebreak
मामकाः पाण्डवाश्चैव किमकुर्वत सञ्जय & ॥ १ ॥ \\
\end{longtable}
}
\pend
\pstart
\begin{sloppypar}\justifying\hyphenrules{nohyphenation}
\noindent धृतराष्ट्र बोले—हे संजय! धर्मभूमि कुरुक्षेत्रमें एकत्रित, युद्धकी इच्छावाले मेरे और पाण्डुके पुत्रोंने क्या किया?॥ १ ॥
\end{sloppypar}
\pend
\endnumbering
\end{Leftside}
\begin{Rightside}
\beginnumbering
\pstart
LATEX-NEEDS-SOME-TEXT-HERE
{\englishfont\bfseries
\settowidth{\mylenone}{dharmakṣetre kurukṣetre samavetā yuyutsavaḥ}
\settowidth{\mylentwo}{māmakāḥ pāṇḍavāścaiva kimakurvata sañjaya}
\setlength{\mylenone}{\maxof{\mylenone}{\mylentwo}}
\setlength{\mylentwo}{\baselineskip}
\setlength{\mylenone}{\mylenone + 1pt}
\setlength{\mylenthree}{(\textwidth - \mylenone)*\real{0.5}}
\settowidth{\mylentwo}{dhṛtarāṣṭra uvāca}
\setlength{\mylentwo}{\mylenthree + (\mylenone - \mylentwo)*\real{0.5}}
\begin{longtable}[l]{@{\hspace*{\mylenthree}}>{\setlength\parfillskip{0pt}}p{\mylenone}@{}@{}l@{}}
\multicolumn{1}{l}{\hspace*{\mylentwo}dhṛtarāṣṭra uvāca} \\ \nopagebreak
dharmakṣetre kurukṣetre samavetā yuyutsavaḥ & \\ \nopagebreak
māmakāḥ pāṇḍavāścaiva kimakurvata sañjaya & \ (1) \\
\end{longtable}
}
\pend
\pstart
\begin{sloppypar}\justifying\hyphenrules{nohyphenation}
\noindent {\englishfont Dhṛtarāṣṭra said: Sañjaya, gathered on the holy land of Kurukṣetra, eager to fight, what did my sons and the sons of Pāṇḍu do?(1)}
\end{sloppypar}
\pend
\endnumbering
\end{Rightside}
\end{pages}
\Pages
{\bfseries
\settowidth{\mylenone}{धर्मक्षेत्रे कुरुक्षेत्रे समवेता युयुत्सवः}
\settowidth{\mylentwo}{मामकाः पाण्डवाश्चैव किमकुर्वत सञ्जय}
\setlength{\mylenone}{\maxof{\mylenone}{\mylentwo}}
\setlength{\mylentwo}{\baselineskip}
\setlength{\mylenone}{\mylenone + 1pt}
\setlength{\mylenthree}{(\textwidth - \mylenone)*\real{0.5}}
\settowidth{\mylentwo}{धृतराष्ट्र उवाच}
\setlength{\mylentwo}{\mylenthree + (\mylenone - \mylentwo)*\real{0.5}}
\begin{longtable}[l]{@{\hspace*{\mylenthree}}>{\setlength\parfillskip{0pt}}p{\mylenone}@{}@{}l@{}}
\multicolumn{1}{l}{\hspace*{\mylentwo}धृतराष्ट्र उवाच} \\ \nopagebreak
धर्मक्षेत्रे कुरुक्षेत्रे समवेता युयुत्सवः & ।\\ \nopagebreak
मामकाः पाण्डवाश्चैव किमकुर्वत सञ्जय & ॥ १ ॥ \\
\end{longtable}
}
\begin{sloppypar}\justifying\hyphenrules{nohyphenation}
\noindent धृतराष्ट्र बोले—हे संजय! धर्मभूमि कुरुक्षेत्रमें एकत्रित, युद्धकी इच्छावाले मेरे और पाण्डुके पुत्रोंने क्या किया?॥ १ ॥
\end{sloppypar}
{\englishfont\bfseries
\settowidth{\mylenone}{dharmakṣetre kurukṣetre samavetā yuyutsavaḥ}
\settowidth{\mylentwo}{māmakāḥ pāṇḍavāścaiva kimakurvata sañjaya}
\setlength{\mylenone}{\maxof{\mylenone}{\mylentwo}}
\setlength{\mylentwo}{\baselineskip}
\setlength{\mylenone}{\mylenone + 1pt}
\setlength{\mylenthree}{(\textwidth - \mylenone)*\real{0.5}}
\settowidth{\mylentwo}{dhṛtarāṣṭra uvāca}
\setlength{\mylentwo}{\mylenthree + (\mylenone - \mylentwo)*\real{0.5}}
\begin{longtable}[l]{@{\hspace*{\mylenthree}}>{\setlength\parfillskip{0pt}}p{\mylenone}@{}@{}l@{}}
\multicolumn{1}{l}{\hspace*{\mylentwo}dhṛtarāṣṭra uvāca} \\ \nopagebreak
dharmakṣetre kurukṣetre samavetā yuyutsavaḥ & \\ \nopagebreak
māmakāḥ pāṇḍavāścaiva kimakurvata sañjaya & \ (1) \\
\end{longtable}
}
\begin{sloppypar}\justifying\hyphenrules{nohyphenation}
\noindent {\englishfont Dhṛtarāṣṭra said: Sañjaya, gathered on the holy land of Kurukṣetra, eager to fight, what did my sons and the sons of Pāṇḍu do?(1)}
\end{sloppypar}
\end{document}
输出第 2 页和第 3 页如下
输出第 4 页如下
问题
- 如果我删除虚拟文本(删除文本 LATEX-NEEDS-SOME-TEXT-HERE),文档将无法编译,并且会出现错误
! You can't use '\lastbox' in vertical mode.
- 第 2 页和第 3 页的长表的第二行和第三行之间有多余的空格
这些问题在pages
环境之外都不存在,例如第 4 页的排版是完美的。不需要虚拟文本,也没有多余的空间。