在段落第一个单词之前立即打印,而不改变其首行缩进?

在段落第一个单词之前立即打印,而不改变其首行缩进?

虽然我的情况可以概括,但如果我描述一个具体的例子也许会更清楚。

我需要将数字作为下标打印在每个段落第一行的左边,但不影响其第一行缩进。

数字与首字母之间的间距必须与脚注数字的默认间距相同。

我一直在尝试定义一个新命令,但无法保持以下文本不变。

以下 MWE 说明了我的意思:

\documentclass[12pt]{book}
\usepackage{fixltx2e}

\newcommand\parnumber[1]{\hspace{-5pt}{\footnotesize}\textsubscript{#1}\kern -2pt\normalsize}

\begin{document}

I should like, before proceeding further, to tell you how I feel...

\parnumber{1} I should like, before proceeding further, to tell you how I feel about the State which we have described. I might compare myself to a person who, on beholding beautiful animals either created by the painter's art, or, better still, alive but at rest, is seized with a desire of seeing them in motion or engaged in some struggle or conflict to which their forms appear suited; this is my feeling about the State which we have been describing. 

\parnumber{2} And we too, Socrates, as Timaeus says, will not be wanting in enthusiasm; and there is no excuse for not complying with your request.

\end{document}

第一行显示了段落应如何缩进。第二行显示了\parnumber命令如何影响其缩进。

我知道命令定义充其量只是原始的。

如何才能将其改进为在段落第一个单词之前立即打印数字,而不改变其首行缩进?

我想过使用浮动框,但我无法让它精确地工作。

答案1

在这里,在我的 MWE 中,我使用了\llap,但另一种形式将\makebox[0pt][r]{...}包括\leavevmode\llap{...}

这是经过编辑的 MWE,以将这些更改合并到\parnumber宏本身中。这\ignorespaces允许您在调用后放置空格或不放置空格\parnumber{1},而不会产生任何不良影响。

\documentclass[12pt]{book}
\usepackage{fixltx2e}

\newcommand\parnumber[1]{\leavevmode\llap{%
  \footnotesize\textsubscript{#1}\,}\ignorespaces}

\begin{document}

I should like, before proceeding further, to tell you how I feel...

\parnumber{1}I should like, before proceeding further, to tell you how I feel about the State which we have described. I might compare myself to a person who, on beholding beautiful animals either created by the painter's art, or, better still, alive but at rest, is seized with a desire of seeing them in motion or engaged in some struggle or conflict to which their forms appear suited; this is my feeling about the State which we have been describing. 

\parnumber{2} And we too, Socrates, as Timaeus says, will not be wanting in enthusiasm; and there is no excuse for not complying with your request.

\end{document}

在此处输入图片描述

相关内容