有什么方法可以实现首字下沉而不强制分段或换行?

有什么方法可以实现首字下沉而不强制分段或换行?

有谁知道如何实现这种效果:

在此处输入图片描述

具体来说,我想要的效果是让大号首字下沉的章节编号“9”出现在页面边缘,即使在 LaTeX 代码中它出现在第 1 节开头的旁边。换句话说,在我的 LaTeX 代码中,顺序如下:

与圣天使一起。” [请求首字下拉“9”] 1 耶稣对他们说:“我实在说......

我想要的是首字下沉出现在页面的边缘,所有的文本都围绕着它流动,甚至(可能)在 LaTeX 代码中出现在它之前的文本。

我尝试了两种方法来实现这一点,但都没有成功:(1)lettrines 包,(2)wrapfig 包。

以下是我使用 lettrines 所得到的:

在此处输入图片描述

尽管我的代码中没有段落分隔符,但 lettrines 包似乎会插入一个段落分隔符。

以下是我使用 wrapfigure 得到的结果:

在此处输入图片描述

这样更接近,因为文本确实围绕着首字母下沉,而且首字母下沉看起来确实嵌入在一个大段落中,而不是开始一个新段落。但是,它确实强制换行,这样章节的第 1 节将始终排版在首字母下沉的章节号旁边。

但我希望的是,首字母下沉总是从第 1 节开始的那一行开始,但并不要求第 1 节总是从这一行的开头开始。这就是这篇文章中第一张图片所展示的:前一节中的单词“圣天使”在第 1 节开始之前围绕着首字母下沉。

这在 LaTeX 中可能实现吗?我认为可以,因为第一张图片是 PTXprint 的屏幕截图,它声称在后台使用 LaTeX。

下面是我针对所讨论的诗句以及其上方和下方诗句编写的代码示例:

\versebeg{8}{38}For whoever is ashamed of me and of my words in this adulterous and sinful generation, the Son of Man shall also be ashamed of him when he comes in the glory of his Father with the holy angels.” \chapbeg{9}\versebeg{9}{1}And he said to them, “Truly I say to you that there are some among those standing here who shall certainly not taste death until they see the kingdom of God come with power.” \par{}\versebeg{9}{2}And after six days Jesus took with him Peter and James and John, and led them up on a high mountain by themselves alone. And he was transfigured before them,

“chapbeg” 只是一个小宏,它设置一个计数器并插入首字下沉:

“versebeg” 是以下宏:

在此处输入图片描述

如果我使用字母,“NumberDrop” 则是这样的:

\newcommand{\NumberDrop}[1]{\lettrine[lines=2,findent=0.1em,nindent=0em,loversize=0.1]{#1}{}}

或者如果我使用 wrapfigure:

在此处输入图片描述

在上面的宏中,“dropnum”是我的首字下沉的放大字体,声明如下:

\newfontfamily\dropnum[Scale=3]{Gentium Plus}

我确实在这里发现了一个几乎相同的问题: 段落中间首字下沉/浮动(lettrine)

那里提出的解决方案非常接近我的需要,只是它没有设置为与我的缩放字体一起使用(我认为它使用“Huge”来产生的数字不够大,无法满足我的目的),更重要的是,如果代码包含任何嵌入的脚注,它会完全锁定 xelatex 编译器。

如有任何帮助或建议我将不胜感激。

更新:

以下是使用 wrapfig 包演示该问题的完整代码示例:

%&program=xelatex
%&encoding=UTF-8 Unicode

\documentclass{article}

\usepackage{wrapfig}
\setlength{\intextsep}{0pt}
\setlength{\columnsep}{1ex}

\usepackage[flushmargin,bottom]{footmisc}
\usepackage[ruled,perpage]{manyfoot}
\usepackage{alphalph}
\DeclareNewFootnote{A}[alph]
\usepackage{fixfoot}

\usepackage{fontspec}
\setmainfont{Times New Roman}
\newfontfamily\dropnum[Scale=3]{Times New Roman}

\newcommand{\NumberDrop}[1]%
{%
    \begin{wrapfigure}{l}{0pt}%
    \dropnum{#1}%
    \end{wrapfigure}%
}

\def\chapbeg#1%
{%
    \NumberDrop{#1}%
}

\def\versebeg#1#2%
{%
    \textsuperscript{\scriptsize{#2}}\nobreak%
}

\newcommand{\cnote}[2]%
{%
    \footnoteA{\textbf{#1}#2}%
}

\begin{document}

\par\versebeg{8}{34}And he called the crowd over, along with his disciples, and said to them, “\cnote{8:34 }{Whoever 95\% ¦ If anyone 5\% ECM* NA SBL TH}Whoever wants to \cnote{8:34 }{follow 65\% ¦ come 35\% SBL TR}follow after me, let him deny himself and take up his cross and follow me. 
\versebeg{8}{35}For whoever desires to save his life shall lose it, but whoever \cnote{8:35 }{loses 95\% ¦ shall lose 5\% NA SBL TH}loses his \cnote{8:35 }{own 55\% ¦ --- 45\% CT TR WP}own life for my sake and for the sake of the good news shall save it. 
\versebeg{8}{36}For what \cnote{8:36 }{shall 99\% ¦ does 0.5\% ECM* NA SBL TH}shall it benefit a person \cnote{8:36 }{if he gains 98.5\% ¦ to gain 0.5\% CT}if he gains the whole world and forfeit his soul? 
\versebeg{8}{37}\cnote{8:37 }{Or what shall 98.5\% ¦ For what can 0.3\% CT}Or what shall a person give in exchange for his soul? 
\versebeg{8}{38}For whoever is ashamed of me and of my words in this adulterous and sinful generation, the Son of Man shall also be ashamed of him when he comes in the glory of his Father with the holy angels.”
\chapbeg{9}\versebeg{9}{1}And he said to them, “Truly I say to you that there are some among those standing here who shall certainly not taste death until they see the kingdom of God come with power.”
\par\versebeg{9}{2}And after six days Jesus took with him Peter and James and John, and led them up on a high mountain by themselves alone. And he was transfigured before them, 
\versebeg{9}{3}and his garments became radiant, extremely white, \cnote{9:3 }{like snow, (73.3\%) ¦ --- (1\%) CT}like snow, such as no launderer on earth can whiten them. 


\end{document}

更新 #2:

我非常接近使用 Mid-Paragraph drop cap 帖子中的 dcpar 解决方案。但是,我看到的是 (a) 为了在两个地方(即在正文和脚注设备中)获得正确的脚注标记,我必须在 dcpar 之前存储脚注计数器的当前值,然后恢复它。并且 (b) 虽然存储/恢复了脚注计数器的正确值,但在 dcpar 宏中没有观察到它。最终结果是,对于每个 dcpar 块,脚注从“a”重新开始(我使用 \alph 作为脚注标记)。

我希望在这个实验代码的第二个 dcpar 中看到的是相同内容的更窄格式,但脚注标记延续到第一个 dcpar 块停止的地方。

请注意,如果我从 manyfoot 中删除“perpage”选项,情况会变得更加有趣。在这种情况下,设备中的脚注标记是正确的,但第二个 dcpar 中的标记甚至更远,因为它们甚至超出了设备中显示的内容。

这是我的实验代码及其输出:

\documentclass[letterpaper,11pt]{book}
\usepackage[flushmargin,bottom]{footmisc}
\usepackage[ruled,perpage]{manyfoot}
\usepackage{alphalph}
\DeclareNewFootnote{A}[alph]
\renewcommand{\thefootnoteA}{\alphalph{\value{footnoteA}}}
\usepackage{fixfoot}

\usepackage{fontspec}
\setmainfont{Times New Roman}
\newfontfamily\dropnum[Scale=3]{Times New Roman}

\newcommand{\NumberDrop}[1]%
{%
  \begin{wrapfigure}{l}{0pt}%
  \dropnum{#1}%
  \end{wrapfigure}%
}

\def\versebeg#1#2%
{%
  \textsuperscript{\scriptsize{#2}}\nobreak%
}

\newcommand{\cnote}[2]%
{%
  \footnoteA{\textbf{#1}#2}%
}

\newcounter{fcount}
\newcounter{gcount}

\makeatletter
\def\dc#1{%
  \setbox0\hbox{\dropnum{#1}\hspace{0.1em}}%
  \leavevmode\vadjust{\vskip\wd0 \penalty123}\rlap{\smash{\copy0}}\vrule width2\wd0 height 1pt depth 0pt\relax}
\def\dcpar#1#2{{%
%\parindent\z@
\emergencystretch.2\hsize
\@tempcnta\z@
\xdef\@pshape{\space}%
\setbox0\vbox{{\hsize#1\relax
#2%
\endgraf
\@tempdima=#1\relax
\loop
\@tempdima\hsize
\dimen@\z@
\ifnum\lastnodetype=11 \unskip\fi
\ifnum\lastnodetype=13
\count@\lastpenalty\unpenalty
\ifnum\count@=123
\dimen@\lastskip
\unskip
\advance\@tempdima-\dimen@
\xdef\@pshape{\the\dimen@\space \the\@tempdima\space\expandafter\eat@two\@pshape}%
\fi
\fi
\ifnum\lastnodetype=\@ne
\setbox\z@\lastbox
\advance\@tempcnta\@ne
\xdef\@pshape{\the\dimen@\space \the\@tempdima\space\@pshape}%
\fi
\ifnum\lastnodetype=\m@ne
\xdef\@pshape{\the\@tempcnta\space\@pshape}%
\else
\repeat
}}%
\parshape=\@pshape
% for babrara \def\dc##1{\leavevmode\vadjust{\rlap{\smash{\raise-\baselineskip\hbox{\Huge##1}}}}}%
\def\dc##1{\leavevmode\strut\vadjust{\rlap{\smash{\raise\dimexpr\dp\strutbox-\baselineskip\relax\hbox{\dropnum{##1}}}}}}%
#2\par
}}
\def\eat@two#1 #2 {}
\makeatother

\begin{document}

\setcounter{fcount}{\value{footnoteA}}
\par\dcpar{\linewidth}{\versebeg{8}{34}And he called the crowd over, along with his disciples, and said to them, “\footnotemarkA{}Whoever wants to \footnotemarkA{}follow after me, let him deny himself and take up his cross and follow me. 
\versebeg{8}{35}For whoever desires to save his life shall lose it, but whoever \footnotemarkA{}loses his \footnotemarkA{}own life for my sake and for the sake of the good news shall save it. 
\versebeg{8}{36}For what \footnotemarkA{}shall it benefit a person \footnotemarkA{}if he gains the whole world and forfeit his soul? 
\versebeg{8}{37}\footnotemarkA{}Or what shall a person give in exchange for his soul? 
\versebeg{8}{38}For whoever is ashamed of me and of my words in this adulterous and sinful generation, the Son of Man shall also be ashamed of him when he comes in the glory of his Father with the holy angels.”
\dc{9}\versebeg{9}{1}And he said to them, “Truly I say to you that there are some among those standing here who shall certainly not taste death until they see the kingdom of God come with power.”}
\setcounter{footnoteA}{\value{fcount}}
\stepcounter{footnoteA}\footnotetextA{\textbf{8:34} Whoever 95\% ¦ If anyone 5\% ECM* NA SBL TH}
\stepcounter{footnoteA}\footnotetextA{\textbf{8:34} follow 65\% ¦ come 35\% SBL TR}
\stepcounter{footnoteA}\footnotetextA{\textbf{8:35} loses 95\% ¦ shall lose 5\% NA SBL TH}
\stepcounter{footnoteA}\footnotetextA{\textbf{8:35} own 55\% ¦ --- 45\% CT TR WP}
\stepcounter{footnoteA}\footnotetextA{\textbf{8:36} shall 99\% ¦ does 0.5\% ECM* NA SBL TH}
\stepcounter{footnoteA}\footnotetextA{\textbf{8:36} if he gains 98.5\% ¦ to gain 0.5\% CT}
\stepcounter{footnoteA}\footnotetextA{\textbf{8:37} Or what shall 98.5\% ¦ For what can 0.3\% CT}
\versebeg{9}{2}And after six days Jesus took with him Peter and James and John, and led them up on a high mountain by themselves alone. And he was transfigured before them, 
\versebeg{9}{3}and his garments became radiant, extremely white, \cnote{9:3 }{like snow, (73.3\%) ¦ --- (1\%) CT}like snow, such as no launderer on earth can whiten them. 

\setcounter{fcount}{\value{footnoteA}}
\par\dcpar{0.75\linewidth}{\versebeg{8}{34}And he called the crowd over, along with his disciples, and said to them, “\footnotemarkA{}Whoever wants to \footnotemarkA{}follow after me, let him deny himself and take up his cross and follow me. 
\versebeg{8}{35}For whoever desires to save his life shall lose it, but whoever \footnotemarkA{}loses his \footnotemarkA{}own life for my sake and for the sake of the good news shall save it. 
\versebeg{8}{36}For what \footnotemarkA{}shall it benefit a person \footnotemarkA{}if he gains the whole world and forfeit his soul? 
\versebeg{8}{37}\footnotemarkA{}Or what shall a person give in exchange for his soul? 
\versebeg{8}{38}For whoever is ashamed of me and of my words in this adulterous and sinful generation, the Son of Man shall also be ashamed of him when he comes in the glory of his Father with the holy angels.”
\dc{9}\versebeg{9}{1}And he said to them, “Truly I say to you that there are some among those standing here who shall certainly not taste death until they see the kingdom of God come with power.”}
\setcounter{footnoteA}{\value{fcount}}
\stepcounter{footnoteA}\footnotetextA{\textbf{8:34} Whoever 95\% ¦ If anyone 5\% ECM* NA SBL TH}
\stepcounter{footnoteA}\footnotetextA{\textbf{8:34} follow 65\% ¦ come 35\% SBL TR}
\stepcounter{footnoteA}\footnotetextA{\textbf{8:35} loses 95\% ¦ shall lose 5\% NA SBL TH}
\stepcounter{footnoteA}\footnotetextA{\textbf{8:35} own 55\% ¦ --- 45\% CT TR WP}
\stepcounter{footnoteA}\footnotetextA{\textbf{8:36} shall 99\% ¦ does 0.5\% ECM* NA SBL TH}
\stepcounter{footnoteA}\footnotetextA{\textbf{8:36} if he gains 98.5\% ¦ to gain 0.5\% CT}
\stepcounter{footnoteA}\footnotetextA{\textbf{8:37} Or what shall 98.5\% ¦ For what can 0.3\% CT}
\versebeg{9}{2}And after six days Jesus took with him Peter and James and John, and led them up on a high mountain by themselves alone. And he was transfigured before them, 
\versebeg{9}{3}and his garments became radiant, extremely white, \cnote{9:3 }{like snow, (73.3\%) ¦ --- (1\%) CT}like snow, such as no launderer on earth can whiten them. 

\end{document}

在此处输入图片描述

答案1

我建议采取两步流程来实现您想要的结果:

  1. 设置没有“章节”编号的段落,以便您可以识别相应的换行符。具体来说,找到新章节第一节正上方的换行符。

  2. 将您的内容准确地插入\chapbeg{<num>}到换行符的位置。

在此处输入图片描述

\documentclass{article}

\usepackage[flushmargin,bottom]{footmisc}
\usepackage[ruled,perpage]{manyfoot}
\usepackage{alphalph}
\DeclareNewFootnote{A}[alph]
\usepackage{fixfoot}

\usepackage{fontspec}
\setmainfont{Times New Roman}
\newfontfamily\dropnum[Scale=3]{Times New Roman}

% More condensed version of \parshape (https://tex.stackexchange.com/a/133660/5764)
\makeatletter
\def\newparshape{\parshape\@npshape0{}}
\def\@npshape#1#2#3{\ifx\\#3\expandafter\@@@npshape\else\expandafter\@@npshape\fi
  {#1}{#2}{#3}}
\def\@@npshape#1#2#3#4#5{%
  \ifnum#3>\z@\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
  {\expandafter\@@npshape\expandafter{\the\numexpr#1+1\relax}{#2 #4 #5}{\numexpr#3-1\relax}{#4}{#5}}%
  {\@npshape{#1}{#2}}}
\def\@@@npshape#1#2#3{#1 #2}
\makeatother
% Temporarily adjusting the text width with paragraphs that extend to the following page (https://tex.stackexchange.com/a/472150/5764)
% Use cases for breaking a paragraph that is not visible to the end user, forcing the paragraph to be set with a full-width/-length
% last line. Then one could insert a \pagebreak if needed, depending on the layout requirements
\newcommand{\parnopar}[1][]{\parfillskip=0pt\par%
  #1%
  \parskip=0pt\noindent\parfillskip=0pt plus1fil}

\newsavebox{\dropcapbox}
\newcommand{\chapbeg}[1]{%
  \parnopar
  \savebox{\dropcapbox}{\dropnum{#1}}%
  \newparshape
    {2}{\dimexpr\wd\dropcapbox+1ex}{\dimexpr\linewidth-\wd\dropcapbox-1ex}
    {1}{0pt}{\linewidth}\\%
  \noindent
  \llap{\raisebox{\dimexpr-\height+.7\baselineskip}[0pt][0pt]{%
    \usebox{\dropcapbox}%
    \hspace{1ex}%
  }}%
  \ignorespaces
}

\newcommand{\versebeg}[2]{%
  \textsuperscript{\scriptsize{#2}}\nobreak%
}

\newcommand{\cnote}[2]{%
  \footnoteA{\textbf{#1}#2}%
}

\begin{document}

\noindent\versebeg{8}{34}And he called the crowd over, along with his disciples, and said to them, “\cnote{8:34 }{Whoever 95\% ¦ If anyone 5\% ECM* NA SBL TH}Whoever wants to \cnote{8:34 }{follow 65\% ¦ come 35\% SBL TR}follow after me, let him deny himself and take up his cross and follow me. 
\versebeg{8}{35}For whoever desires to save his life shall lose it, but whoever \cnote{8:35 }{loses 95\% ¦ shall lose 5\% NA SBL TH}loses his \cnote{8:35 }{own 55\% ¦ --- 45\% CT TR WP}own life for my sake and for the sake of the good news shall save it. 
\versebeg{8}{36}For what \cnote{8:36 }{shall 99\% ¦ does 0.5\% ECM* NA SBL TH}shall it benefit a person \cnote{8:36 }{if he gains 98.5\% ¦ to gain 0.5\% CT}if he gains the whole world and forfeit his soul? 
\versebeg{8}{37}\cnote{8:37 }{Or what shall 98.5\% ¦ For what can 0.3\% CT}Or what shall a person give in exchange for his soul? 
\versebeg{8}{38}For whoever is ashamed of me and of my words in this adulterous and sinful generation, the Son of Man shall also be ashamed of him when he
\chapbeg{9}comes in the glory of his Father with the holy angels.”
\versebeg{9}{1}And he said to them, “Truly I say to you that there are some among those standing here who shall certainly not taste death until they see the kingdom of God come with power.”
\par\versebeg{9}{2}And after six days Jesus took with him Peter and James and John, and led them up on a high mountain by themselves alone. And he was transfigured before them, 
\versebeg{9}{3}and his garments became radiant, extremely white, \cnote{9:3 }{like snow, (73.3\%) ¦ --- (1\%) CT}like snow, such as no launderer on earth can whiten them. 

\end{document}

以上面为例,这是步骤 1 的输出:

在此处输入图片描述

我将其标识he为新第 9 章第一节上方一行的最后一个单词。因此,我将其插入\chapbeg{9}到该位置,然后按照相同的过程继续下一章。

该过程背后的想法是强制以全宽段落结尾(通过\parnopar)。然后,在调整后的段落形状内设置章节编号(通过\newparshape) 以允许数字周围的流动。数字周围的段落缩进宽度是自动计算的。

相关内容