5

I am trying to reproduce in plain TeX the following section style (that is placing text inside the indent of a paragraph):

source

Here is what I have done so far:

\font\rm=ecrm10 \font\bf=ecbx10
\rm

\llap{\vbox{\halign{\hfil\bf#\hfil\cr
La première partie\cr
(chap.~1--29)\cr}}}
\hangafter=3
Après avoir donné une brève définition du monde (1,1), Ampélius utilise le rappel de la théorie des quatre éléments (1,2) comme schéma directeur de l'exposé d'astronomie et de géographie qui forme la première section de cette première partie\thinspace:

\bye

attempt

I think I will have to measure the box created by halign and to prevent line breaks too.

NB. I will not use those fonts in my final document, it is just a quick hack to make accents work.

1
  • note the text you posted here is in UTF-8 so accented characters are multi-byte and would not produce the output shown Mar 23 at 22:31

2 Answers 2

6

David Carlisle makes a good point about keeping the indentation constant, but if you don't want to do that for whatever reason, this macro does measure the width of the alignment.

This solution gives you a macro \inindent which when given material with \crs properly placed, automatically does the indentation for you.

The material is placed right below the first baseline, and it is probably not actually be centered with respect to the first lines in the paragraph. The macro will also break if the height of the lines don't match up.

inindent example

\font\rm=ecrm10 \font\bf=ecbx10
\rm

\def\hangpad{.25cm}
\newcount\hangcount
\def\inindent#1{%
    \hangcount=0\relax%
    \setbox0=\vbox to 0pt{%
        \tabskip=0pt plus 1fil\relax%
        \everycr={\noalign{\global\advance\hangcount by -1\relax}}%
        \halign{\hfil\bf##\hfil\crcr%
            #1\crcr
        }%
        \vss%
    }%
    \hangindent=\dimexpr\wd0 + \hangpad * 2\relax%
    \hangafter=\hangcount%
    \noindent\kern-\hangindent\hbox{\kern\hangpad\relax\box0\kern\hangpad\relax}%
}

\inindent{La premiére partie\cr (chap.~1--29)}%
Après avoir donné une brève définition du monde (1,1), Ampélius utilise le rappel de la
théorie des quatre éléments (1,2) comme schéma directeur de l'exposé d'astronomie et de
géographie qui forme la première section de cette première partie\thinspace:
Après avoir donné une brève définition du monde (1,1), Ampélius utilise le rappel de la
théorie des quatre éléments (1,2) comme schéma directeur de l'exposé d'astronomie et de
géographie qui forme la première section de cette première partie\thinspace:

\bye

You can change the amount of padding around the material in the indent with \hangpad.

1
  • Do you if there is a way to make the box perfectly centered with respect to the first three lines?
    – John
    Mar 24 at 10:37
6

enter image description here

You could measure the width but (probably) it is better to indent all sections by the same amount so I centred in a fixed width

Save the following as latin1

\font\rm=ecrm10 \font\bf=ecbx10
\rm



\parindent=0pt
\hangindent=4cm
\hangafter=-3
\noindent\llap{\smash{\lower 17pt\hbox to\hangindent{\hss\vbox{%
\halign{\hfil\bf#\hfil\cr
La première partie\cr
(chap.~1--29)\cr}}\hss}}}%
Après avoir donné une brève définition du monde (1,1), Ampélius
utilise le rappel de la théorie des quatre éléments (1,2) comme schéma
directeur de l'exposé d'astronomie et de géographie qui forme la
première section de cette première partie\thinspace:
Après avoir donné une brève définition du monde (1,1), Ampélius
utilise le rappel de la théorie des quatre éléments (1,2) comme schéma
directeur de l'exposé d'astronomie et de géographie qui forme la
première section de cette première partie\thinspace:

\bye

3
  • Is the 17pt eyballed?
    – John
    Mar 23 at 22:43
  • 2
    @John yes, you could use some exact arithmetic for 2 lines in a 3 line slot, but with text below and space above I have as much faith in my eye as my arithmetic, if it looks OK it is OK probably 18pt = 1.5\baselineskip is relevant Mar 23 at 22:45
  • Great, thank you.
    – user574859
    Apr 7 at 12:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .