3

Although my case can be generalised, perhaps it would be clearer if I describe a specific example.

I need to print a digit as a subscript, immediately to the left of the first line of each paragraph, but without disturbing its first line indentation.

The digit has to have the same spacing to the first letter as the default spacing of a footnote digit.

I have been trying to define a new command, but I am unable to keep the following text unaltered.

The following MWE shows what I mean:

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

The very first line shows how the paragraph should be indented. The second line shows how its indentation is affected by the \parnumber command.

I am aware that the command definition is primitive at best.

How can it be refined to print the digit immediately before the first word of paragraph, without altering its first line indentation?

I thought of using a floating box, but I can't make it work precisely.

  • Thanks for asking, but no, the digit has to have the same spacing to the first letter as the default spacing of the footnote digit. – gsl Oct 17 '14 at 17:19
4

Here, in my MWE, I use an \llap, but an alternate form would include \makebox[0pt][r]{...} in lieu of the \leavevmode\llap{...}

Here is the MWE, EDITED to incorporate these changes into the \parnumber macro itself. The \ignorespaces allows you to either place a space after the \parnumber{1} invocation or not, without any ill effect.

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

enter image description here

| improve this answer | |
  • 1
    @gsl I edited to incorporate the technique into the \parnumber macro itself. – Steven B. Segletes Oct 17 '14 at 17:32
  • Wonderful. I don't think I could have found a connection to \llap that easily. Thank you! – gsl Oct 17 '14 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.