排版文本和评论,并进行合理的分页

排版文本和评论,并进行合理的分页

任何系统(我接受 LaTeX、ConTeXt、纯 TeX、OPmac,任何可用的系统),我想排版四个连续的文本流——源文本、注释 A、注释 B、注释 C——并将它们分成几页,这样它们在一个典型的页面上一个接一个地出现(见下图)。问题是文本的长度可能相差很大:

  • 有时原文中有几页可能没有任何评论,并且
  • 有时原文中的一句话可能会有几页的评论。

因此,主要任务是自动分页,通过跟踪四个(或多个)流的累计长度,在需要时分页,并继续跨页。现有的 LaTeX 软件包,如雷莱德麦克不是为这种用例设计的,并且无法处理这种情况(例子)。

尽管我对任何系统都持开放态度,但我还是使用 ConTeXt 和 OPmac 来标记这个,只是因为我认为 LuaTeX 在这里可能会有帮助。


背景:对于梵文书籍,传统上将文本与其注释一起排版,如下页所示。(在 archive.org 上搜索“三篇注释”等可找到所需页面布局的更多示例:这里这里这里这里

示例页面

这是所需结果的 MWE(包含源文本和两个注释 A 和 B),但分页符是手动选择的。我们希望实现相同的结果,而不必手动选择每个分页符的位置。

\documentclass{article}

\usepackage[papersize={4in,4in}, total={3in,3in}]{geometry}

% A "\Repeat" command: https://tex.stackexchange.com/a/16192
\usepackage{expl3}
\ExplSyntaxOn
\cs_new_eq:NN \Repeat \prg_replicate:nn
\ExplSyntaxOff

\begin{document}

\parindent=0pt
\parskip=0.5\baselineskip

% Start: 5 sentences of commentary for each source sentence.

Source text sentence number 1.
Source text sentence number 2.
Source text sentence number 3.

\medskip \hrule

{\footnotesize
    \Repeat{5}{Commentary A on sentence 1. }
    \Repeat{5}{Commentary A on sentence 2. }
    \Repeat{4}{Commentary A on sentence 3. } Commentary A on senten-
}

\medskip \hrule

{\footnotesize
    \Repeat{5}{Commentary B on sentence 1. } 
    \Repeat{5}{Commentary B on sentence 2. }
    \Repeat{3}{Commentary B on sentence 3. } Co-
}

\newpage

% Continued. Long lengths:
% 10 lines of commentary each on sentence 4.
% 15 lines of commentary each on sentence 5 (partly fits here).

Source text sentence 4.
Source text sentence 5.
S-

\medskip \hrule

{\footnotesize
    ce 3.
    \Repeat{10}{Commentary A on sentence 4. }
    \Repeat{4}{Commentary A on sentence 5. } Commentary
}

\medskip \hrule

{\footnotesize
    mmentary B on sentence 3. Commentary B on sentence 3.
    \Repeat{10}{Commentary B on sentence 4. }
    \Repeat{3}{Commentary B on sentence 5. } Co-
}

\newpage

% Continued: note only commentary on this page.

\hrule

{\footnotesize
    A on sentence 5. \Repeat{15}{Commentary A on sentence 5. }
}

\medskip \hrule

{\footnotesize
    mmentary B on sentence 5. \Repeat{12}{Commentary B on sentence 5. } Commen-
}

\newpage

% Continued: source text continues.
% Sentences 6 to 10 have no commentary.

ource text sentence 6.
Source text sentence 7.
Source text sentence 8.
Source text sentence 9.
Source text sentence 10.

\medskip \hrule

\medskip \hrule

{\footnotesize
    tary B on sentence 5. \Repeat{3}{Commentary B on sentence 5. }
}

\end{document}

结果:

期望输出


尝试bigfoot:有点用,但是文本超出了页面的底部并且丢失了。

\documentclass{article}
\usepackage[papersize={4in,4in}, total={3in,3in}]{geometry}

\usepackage{lipsum}

\usepackage{bigfoot}
\DeclareNewFootnote[para]{A}
\DeclareNewFootnote[para]{B}[alph]

\begin{document}

% Several paragraphs of commentary that occur before the first word of the text. 
\footnoteA{\lipsum[1-4]}

firstword\footnoteA{\lipsum[5-8]}
secondword\footnoteA{\lipsum[9-12]} (1)\footnoteB{a few words}

thirdword\footnoteA{\lipsum[13]}
fourthword\footnoteA{\lipsum[14-16]} (2)

\end{document}

结果的前几页:

大脚怪结果

(请注意第 3 页的浪费空间以及第 4 页的溢出/截断。)


我想象类似下面的算法会起作用:

  • 给定源文本 S 和评论 C1、C2、C3(其中“3”代表任意小数),它们被分成形式为 (s, c1, c2, c3) 的匹配“单元”。
  • 维护(垂直)列表 lines[S]、lines[C1]、lines[C2]、lines[C3],每个列表最初都是空的。
  • 对于每个单元 (s, c1, c2, c3),
    • 对每行进行排版(即分成几行),并将这些行分别附加到行 [S]、行 [C1]、行 [C2]、行 [C3]。
    • 如果lines[S] + lines[C1] + lines[C2] + lines[C3]的当前高度总和仍然小于页面高度,则继续。
    • 否则,用这四行中的适当比例填充当前页面,并重复,直到总高度小于页面的高度。
  • 最后,刷新四个列表的剩余内容。

答案1

第 2 阶段版本——

又向前迈了半步:通过参数化的输入和输出实现一定程度的自动化。

通信 1

通讯 2 第 1 部分

通讯 2 第 2 部分

平均能量损失

\documentclass{article}

\usepackage[papersize={4in,6in}, total={3in,5in}]{geometry}

\usepackage{xcolor}
\usepackage{fontspec}
\setmainfont{Noto Serif}%[Colour=blue]
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\tcbuselibrary{breakable}
\tcbuselibrary{magazine}
\usetikzlibrary{decorations.pathmorphing}


\usepackage{ekdosis}
\SetLineation{lineation=none}

\FormatDiv{1}{\begin{center}\Large}{\end{center}}
 \FormatDiv{2}{\begin{center}\large}{\end{center}}
 \FormatDiv{3}{\bfseries}{.}

%\SetDefaultApparatus{rec1}
%\DeclareApparatus{rec1} % new layer set as default
%\DeclareApparatus{rec2} % additional layer below the default one
%\DeclareApparatus{rec3} 


%\SetHooks{lemmastyle=\bfseries\color{red},}
%
%\setlength{\columnseprule}{0.4pt}

\newcommand\comm[1]{\hrule\vspace{0.25ex}#1}
\newcommand\commA{\comm{A}}
\newcommand\commB{\comm{B}}
\newcommand\commC{\comm{C}}

\newboxarray{commA}
\newboxarray{commB}
\newboxarray{commC}



\newcommand\breakatcommon{3cm/3cm}
\newcommand\breakatA{\breakatcommon}
\newcommand\breakatB{\breakatcommon}
\newcommand\breakatC{\breakatcommon}




\ExplSyntaxOn



        \cs_generate_variant:Nn 
            \seq_gset_split:Nnn 
            { cno }


\tl_new:N \g_comm_Amapin_tl
\tl_new:N \g_comm_Bmapin_tl
\tl_new:N \g_comm_Cmapin_tl

\tl_new:N \g_comm_Amapout_tl
\tl_new:N \g_comm_Bmapout_tl
\tl_new:N \g_comm_Cmapout_tl
\tl_new:N \g_comm_mapout_tl

\seq_new:N \g_comm_Amapout_seq
\seq_new:N \g_comm_Bmapout_seq
\seq_new:N \g_comm_Cmapout_seq
\seq_new:N \g_comm_mapout_seq


%\int_new:N \g_comm_maxpart_int

\int_new:N \g_comm_Amapout_int
\int_new:N \g_comm_Bmapout_int
\int_new:N \g_comm_Cmapout_int

\int_new:N \g_comm_collected_int
\int_new:N \g_comm_tocollect_int

\int_new:N \g_comm_pagenum_int

\int_new:N \g_comm_Aparonpage_int
\int_new:N \g_comm_Bparonpage_int
\int_new:N \g_comm_Cparonpage_int





\bool_new:N \g_comm_collectible_bool
\bool_new:N \g_comm_source_bool

%-----------------------------------------------------
\NewDocumentCommand { \checksourcestatus } { } { 

            \bool_if:nTF {
                 {\int_compare_p:nNn
                   { \g_comm_Amapout_int } < { \mysizeA }}
                    ||
                 {\int_compare_p:nNn
                   { \g_comm_Bmapout_int } < { \mysizeB }}
                    ||
                 {\int_compare_p:nNn
                   { \g_comm_Cmapout_int } < { \mysizeC }}
            }
            { % T: more to process
                    \bool_gset_true:N \g_comm_source_bool
            }
            { % F: no more to process
                    \bool_gset_false:N \g_comm_source_bool
            }


}




%-----------------------------------------------------
\NewDocumentCommand { \checkcollectstatus } { } { 

            \bool_if:nTF 
            {
                %:
                {
                    % A &B & C
                    \seq_if_empty_p:N \g_comm_Amapout_seq
                    &&
                    \seq_if_empty_p:N \g_comm_Bmapout_seq
                    &&
                    \seq_if_empty_p:N \g_comm_Cmapout_seq
                    }
                %or
                ||
                {
                 \int_compare_p:n
                   { \g_comm_collected_int >= \g_comm_tocollect_int }
                }
            
            }
            { % T: no more to collect
                    \bool_gset_false:N \g_comm_collectible_bool
            }
            { % F: more to collect
                    \bool_gset_true:N \g_comm_collectible_bool
            }


}






%-----------------------------------------------------
\NewDocumentCommand { \setABCmapout } { m } { 
% 1 = seq name

        \tl_gset:Nx \g_comm_currseqname_tl { #1 }

%output:
\tl_gclear:N \g_comm_Amapout_tl
\tl_gclear:N \g_comm_Bmapout_tl
\tl_gclear:N \g_comm_Cmapout_tl
\tl_gclear:N \g_comm_mapout_tl

%===================

\tl_if_empty:NF
        \g_comm_Amapin_tl
        {
                \seq_gset_split:NnV
                            \g_comm_Amapout_seq
                            {}
                            \g_comm_Amapin_tl
            \int_gincr:N \g_comm_Amapout_int        
        }
        
\tl_if_empty:NF
        \g_comm_Bmapin_tl
        {
                \seq_gset_split:NnV
                            \g_comm_Bmapout_seq
                            {}
                            \g_comm_Bmapin_tl
            \int_gincr:N \g_comm_Bmapout_int        
        }
                    
\tl_if_empty:NF
        \g_comm_Cmapin_tl
        {
                \seq_gset_split:NnV
                            \g_comm_Cmapout_seq
                            {}
                            \g_comm_Cmapin_tl
            \int_gincr:N \g_comm_Cmapout_int        
        }

%           \seq_show:N
%                   \g_comm_Cmapout_seq




                    \checksourcestatus
%                   \bool_show:N \g_comm_source_bool
                    \int_gset:Nn \g_comm_pagenum_int { 0 }

            \bool_while_do:Nn \g_comm_source_bool
            {
%   \checksourcestatus

                    \int_gincr:N \g_comm_pagenum_int                    
                    

                    \int_gset:Nn \g_comm_collected_int { 0 }

%1st page
%%%     \int_compare:nNnTF
%%%       { \g_comm_pagenum_int } = { 1 }
%%%        {
                    \int_gset:Nn \g_comm_tocollect_int { 3 }
%%%             }       
%%%        {
%%%                 \int_gset:Nn \g_comm_tocollect_int { 4 }
%%%             }       

                \int_set:Nn \g_comm_collected_int { 0 }
        
                \checkcollectstatus
%\bool_show:N   \g_comm_collectible_bool
                    
                    \newpage

% for each page:
\int_gset:Nn \g_comm_Aparonpage_int { 0 }
\int_gset:Nn \g_comm_Bparonpage_int { 0 }
\int_gset:Nn \g_comm_Cparonpage_int { 0 }



                    
%1st page
        \int_compare:nNnT
          { \g_comm_pagenum_int } = { 1 }
           {
                    \mfsgetitem{\tl_use:N \g_comm_currseqname_tl}{1} %%%%% current sequence

    \int_gset:Nn
            \g_comm_Amapout_int
            { 0 }
    \int_gset:Nn
            \g_comm_Bmapout_int
            { 0 }
    \int_gset:Nn
            \g_comm_Cmapout_int
            { 0 }
                }       

            
            \bool_while_do:Nn \g_comm_collectible_bool
            {
%   \checksourcestatus

% commA:
            \seq_if_empty:NF
            \g_comm_Amapout_seq
            {
        \int_gincr:N \g_comm_Amapout_int
        \int_gincr:N \g_comm_Aparonpage_int
        
        \int_compare:nNnT
          { \g_comm_Aparonpage_int } = { 1 }
           {
                        \ekddiv{head={\commA}, type=paragraph, depth=2, n=II.1.A}
                }       
\tex_par:D      \noindent\useboxarray[commA]{\int_use:N \g_comm_Amapout_int } 
%\seq_show:N    \g_comm_Amapout_seq     
        \seq_gpop_left:NN   \g_comm_Amapout_seq \l_tmpa_tl
%\seq_show:N    \g_comm_Amapout_seq     
        \int_gincr:N \g_comm_collected_int
        \checkcollectstatus
            }

% commB:
            \seq_if_empty:NF
            \g_comm_Bmapout_seq
            {
        \int_gincr:N \g_comm_Bmapout_int
        \int_gincr:N \g_comm_Bparonpage_int
        \int_compare:nNnT
          { \g_comm_Bparonpage_int } = { 1 }
           {
                    \ekddiv{head={\commB}, type=paragraph, depth=2, n=II.1.B}
                }       
\tex_par:D      \noindent\useboxarray[commB]{\int_use:N \g_comm_Bmapout_int } 
        \seq_gpop_left:NN   \g_comm_Bmapout_seq \l_tmpa_tl
        \int_gincr:N \g_comm_collected_int
        \checkcollectstatus
            }



% commC:
            \seq_if_empty:NF
            \g_comm_Cmapout_seq
            {
        \int_gincr:N \g_comm_Cmapout_int
        \int_gincr:N \g_comm_Cparonpage_int
        \int_compare:nNnT
          { \g_comm_Cparonpage_int } = { 1 }
           {
                        \ekddiv{head={\commC}, type=paragraph, depth=2, n=II.1.C}
                }       
\tex_par:D      \noindent\useboxarray[commC]{\int_use:N \g_comm_Cmapout_int } 
        \seq_gpop_left:NN   \g_comm_Cmapout_seq \l_tmpa_tl
        \int_gincr:N \g_comm_collected_int
        \checkcollectstatus
            }
            
    } % while collectible 

    \checksourcestatus
%   \bool_show:N \g_comm_source_bool

    } % while source 

}




\NewDocumentCommand { \setABCmapin } { } { 

\boxarraygetsize[commA]{\mysizeA}
\boxarraygetsize[commB]{\mysizeB}
\boxarraygetsize[commC]{\mysizeC}



\tl_gset:Nx 
        \g_comm_Amapin_tl 
        { 
            \prg_replicate:nn { \mysizeA } { A } 
        }
        
\tl_gset:Nx 
        \g_comm_Bmapin_tl
        { 
            \prg_replicate:nn { \mysizeB } { B } 
        }
        
\tl_gset:Nx 
        \g_comm_Cmapin_tl
        { 
            \prg_replicate:nn { \mysizeC } { C } 
        }
%\tl_show:N 
%       \g_comm_Cmapin_tl
}


\NewDocumentCommand { \mfsgetitem } { o m m } { 
% 1=namespace
% 2=seq name
% 3=item


                \IfNoValueTF { #1 } 
                        { \tl_clear:N \g_fc_namespace_tl } 
                        { \tl_gset:Nn \g_fc_namespace_tl { #1 } }



    \tl_set:Nx
            \l_tmpa_tl
            {
                \seq_item:cn
                        { g_fc_rwe \g_fc_namespace_tl #2 _seq }
                        { #3 }
            }

    \tl_use:N
            \l_tmpa_tl

}



\tl_new:N \g_comm_currseqname_tl

\NewDocumentCommand { \mfsloadaseql } { o m m +m } { 
% 1=namespace
% 2=seq name
% 3=sep
% 4=data

                \IfNoValueTF { #1 } 
                        { \tl_clear:N \g_fc_namespace_tl } 
                        { \tl_gset:Nn \g_fc_namespace_tl { #1 } }

%   \tl_gset:Nx \g_comm_currseqname_tl { #2 }

    \cs_if_free:cT
            { g_fc_rwe \g_fc_namespace_tl #2 _seq }
            { \seq_new:c
                    { g_fc_rwe \g_fc_namespace_tl #2 _seq } 
            }
            
    \seq_gclear:c 
            { g_fc_rwe \g_fc_namespace_tl #2 _seq } 
    \seq_gset_split:cno 
            { g_fc_rwe \g_fc_namespace_tl #2 _seq } 
            { #3 } 
            { #4 }

}

\ExplSyntaxOff



\newcommand\boxcommA[1]{%
\begin{tcolorbox}[enhanced jigsaw,size=fbox,width=\textwidth,
colback=yellow!10,colframe=yellow!10!black,
fontupper=\footnotesize,
breakable,% use only breakable in the real world!
break at=\breakatA,
height fixed for=none,
watermark text=A\arabic{tcbbreakpart},
reset box array=commA,
store to box array=commA,
extras last={
borderline south={0.25mm}{-0.5mm}{blue,decoration={zigzag,amplitude=0.5mm},decorate}},
extras unbroken and last={
borderline south={0.25mm}{-0.5mm}{blue,decoration={zigzag,amplitude=0.5mm},decorate}},
]
#1
\end{tcolorbox}
}

\newcommand\boxcommB[1]{%
\begin{tcolorbox}[enhanced jigsaw,size=fbox,width=\textwidth,
colback=blue!10,colframe=yellow!10!black,
fontupper=\footnotesize,
breakable,% use only breakable in the real world!
break at=\breakatB,
height fixed for=none,
watermark text=B\arabic{tcbbreakpart},
reset box array=commB,
store to box array=commB,
extras last={
borderline south={0.25mm}{-0.5mm}{blue,decoration={zigzag,amplitude=0.5mm},decorate}},
extras unbroken and last={
borderline south={0.25mm}{-0.5mm}{blue,decoration={zigzag,amplitude=0.5mm},decorate}},
]
#1
\end{tcolorbox}
}

\newcommand\boxcommC[1]{%
\begin{tcolorbox}[enhanced jigsaw,size=fbox,width=\textwidth,
colback=green!10,colframe=red!10!black,
fontupper=\footnotesize,
breakable,% use only breakable in the real world!
break at=\breakatC,
height fixed for=none,
watermark text=C\arabic{tcbbreakpart},
reset box array=commC,
store to box array=commC,
extras last={
borderline south={0.25mm}{-0.5mm}{blue,decoration={zigzag,amplitude=0.5mm},decorate}},
extras unbroken and last={
borderline south={0.25mm}{-0.5mm}{blue,decoration={zigzag,amplitude=0.5mm},decorate}},
]
#1
\end{tcolorbox}
}

\newcommand\docommentarypart[1]{
\begin{ekdosis}
\boxcommA{\mfsgetitem{#1}{2}}
\boxcommB{\mfsgetitem{#1}{3}}
\boxcommC{\mfsgetitem{#1}{4}}
\setABCmapin
\setABCmapout{#1}
\end{ekdosis}
}





\input{commdata.tex}





\begin{document}

Commentaries

%=======================
\docommentarypart{c1}

%=======================
\docommentarypart{c2}

\end{document}

输入文件commdata.tex为:

\mfsloadaseql{c1}{comm}{%
Source text sentence number 1.
Source text sentence number 2.
Source text sentence number 3.
comm A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A 

A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A 
comm Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B 

Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B 

Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B 
comm Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C 
}

%==================================
\mfsloadaseql{c2}{commx}{%
Extracts from Wikipedia for the Solar System, Venus, and Mars.
commx The Solar System[c] is the gravitationally bound system of the Sun and the objects that orbit it. It formed 4.6 billion years ago from the gravitational collapse of a giant interstellar molecular cloud. The vast majority (99.86\%) of the system's mass is in the Sun, with most of the remaining mass contained in the planet Jupiter. The four inner system planets—Mercury, Venus, Earth and Mars—are terrestrial planets, being composed primarily of rock and metal. The four giant planets of the outer system are substantially larger and more massive than the terrestrials. The two largest, Jupiter and Saturn, are gas giants, being composed mainly of hydrogen and helium; the next two, Uranus and Neptune, are ice giants, being composed mostly of volatile substances with relatively high melting points compared with hydrogen and helium, such as water, ammonia, and methane. All eight planets have nearly circular orbits that lie near the plane of Earth's orbit, called the ecliptic. 
commx Venus is the second planet from the Sun. It is sometimes called Earth's "sister" or "twin" planet as it is almost as large and has a similar composition. As an interior planet to Earth, Venus (like Mercury) appears in Earth's sky never far from the Sun, either as morning star or evening star. Aside from the Sun and Moon, Venus is the brightest natural object in Earth's sky, capable of casting visible shadows on Earth at dark conditions and being visible to the naked eye in broad daylight.[18][19]

Venus is the second largest terrestrial object of the Solar System, with a surface gravity minimally lower than on Earth, but having only an induced magnetosphere. The carbon dioxide atmosphere of Venus is the densest of the four terrestrial planets. The atmospheric pressure at the planet's surface is about 92 times the sea level pressure of Earth, or roughly the pressure at 900 m (3,000 ft) underwater on Earth. Even though Mercury is closer to the Sun, Venus has the hottest surface of any planet in the Solar System, with a mean temperature of 737 K (464 °C; 867 °F). Venus is shrouded by an opaque layer of highly reflective clouds of sulfuric acid, making it the planet with the highest albedo in the Solar System and preventing its surface from being seen from Earth in light. It may have had water oceans in the past,[20][21] but after these evaporated the temperature rose under a runaway greenhouse effect.[22] The water has probably photodissociated, and the free hydrogen has been swept into interplanetary space by the solar wind because of the lack of an internally induced magnetic field.[23] At roughly 50 km above the surface atmospheric conditions reach Earth-like temperatures and levels of pressure. The possibility of life on Venus has long been a topic of speculation but convincing evidence has yet to be found. 
commx Mars is the fourth planet from the Sun and the second-smallest planet in the Solar System, being larger than only Mercury. In the English language, Mars is named for the Roman god of war. Mars is a terrestrial planet with a thin atmosphere (less than 1% that of Earth's), and has a crust primarily composed of elements similar to Earth's crust, as well as a core made of iron and nickel. Mars has surface features such as impact craters, valleys, dunes, and polar ice caps. It has two small and irregularly shaped moons: Phobos and Deimos.

Some of the most notable surface features on Mars include Olympus Mons, the largest volcano and highest known mountain on any planet in the Solar System, and Valles Marineris, one of the largest canyons in the Solar System. The Borealis basin in the Northern Hemisphere covers approximately 40\% of the planet and may be a large impact feature.[20] Days and seasons on Mars are comparable to those of Earth, as the planets have a similar rotation period and tilt of the rotational axis relative to the ecliptic plane. Liquid water on the surface of Mars cannot exist due to low atmospheric pressure, which is less than 1\% of the atmospheric pressure on Earth.[21][22] Both of Mars's polar ice caps appear to be made largely of water.[23][24] In the distant past, Mars was likely wetter, and thus possibly more suited for life. However, it is unknown whether life has ever existed on Mars.
}

第 1 阶段(手动;概念验证)

第 1 页

第2页

每个 ekdosis 部门都包含一个 tcolorbox,并将其存储为可破坏框的数组,并且已知它们的高度,因此,首先应该可以计算出在何处为任何框数组项 N>=2 动态插入分页符。

平均能量损失

\documentclass{article}

\usepackage[papersize={4in,6in}, total={3in,5in}]{geometry}

\usepackage{xcolor}
\usepackage{fontspec}
\setmainfont{Noto Serif}%[Colour=blue]
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\tcbuselibrary{breakable}
\tcbuselibrary{magazine}

\usepackage{ekdosis}
\SetLineation{lineation=none}

\FormatDiv{1}{\begin{center}\Large}{\end{center}}
 \FormatDiv{2}{\begin{center}\large}{\end{center}}
 \FormatDiv{3}{\bfseries}{.}

\SetDefaultApparatus{rec1}
\DeclareApparatus{rec1} % new layer set as default
\DeclareApparatus{rec2} % additional layer below the default one
\DeclareApparatus{rec3} 


\SetHooks{lemmastyle=\bfseries\color{red},}

\setlength{\columnseprule}{0.4pt}

\newcommand\comm[1]{\hrule\vspace{0.25ex}#1}
\newcommand\commA{\comm{A}}
\newcommand\commB{\comm{B}}
\newcommand\commC{\comm{C}}

\newboxarray{commA}
\newboxarray{commC}


\begin{document}



Commentaries

 \begin{ekdosis}
 \ekddiv{
 head={XXX}, 
 type=section,
 depth=1,
 n=I
}
Source text sentence number 1.
Source text sentence number 2.
Source text sentence number 3.
%Source text sentence 4.
%Source text sentence 5.
%Source text sentence 6.
%Source text sentence 7.
%Source text sentence 8.
%Source text sentence 9.
%Source text sentence 10.

 \ekddiv{
 head={\commA},
 type=paragraph,
 depth=2,
 n=II.1.A
}
\begin{tcolorbox}[enhanced jigsaw,size=fbox,width=\textwidth,
colback=yellow!10,colframe=white,
fontupper=\footnotesize,
breakable,% use only breakable in the real world!
break at=2cm/2cm,
height fixed for=all,
watermark text=\arabic{tcbbreakpart},
reset box array=commA,
store to box array=commA,
]
A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A 

A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A 
\end{tcolorbox}
\noindent\useboxarray[commA]{1}

\ekddiv{head=\commB, type=paragraph, depth=2, n=II.1.B}
\begin{tcolorbox}[enhanced jigsaw,size=fbox,width=\textwidth,
colback=blue!10,colframe=yellow!10!black,
fontupper=\footnotesize,
breakable,% use only breakable in the real world!
break at=2cm/2cm,
height fixed for=all,
watermark text=\arabic{tcbbreakpart},
reset box array,
store to box array
]
Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B 

Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B 

Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B Text B 
\end{tcolorbox}
\noindent\useboxarray{1}


    \ekddiv{head={\commC}, type=paragraph, depth=2, n=II.1.C}
\begin{tcolorbox}[enhanced jigsaw,size=fbox,width=\textwidth,
colback=green!10,colframe=yellow!10!black,
fontupper=\footnotesize,
breakable,% use only breakable in the real world!
break at=2cm/2cm,
height fixed for=all,
watermark text=\arabic{tcbbreakpart},
reset box array=commC,
store to box array=commC,
]
Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C Text C 
\end{tcolorbox}
\noindent\useboxarray[commC]{1}

\newpage
    \ekddiv{head={\commA}, type=paragraph, depth=2, n=II.1.C}
\boxarraygetsize[commA]{\mysizeA}
\foreach \n in {2,...,\mysizeA} { \noindent\useboxarray[commA]{\n}  }

    \ekddiv{head={\commB}, type=paragraph, depth=2, n=II.1.C}
\boxarraygetsize{\mysizeB}
\foreach \n in {2,...,\mysizeB} { \noindent\useboxarray{\n} }

    \ekddiv{head={\commC}, type=paragraph, depth=2, n=II.1.C}
\boxarraygetsize[commA]{\mysizeC}
\foreach \n in {2,...,\mysizeC} { \noindent\useboxarray[commC]{\n}  }

 \end{ekdosis}


\end{document}

答案2

我不确定我是否完全理解了这个问题(我的思维和/或记忆已经不再像以前那样了),但是......

该类memoir(的扩展版本book)提供了几个类/系列的脚注。

详细信息请阅读手册(texdoc memoir12.1.1 各种脚注

相关内容