[texhax] [solved] Re: Variable indentation of paragraph titles

Rodolfo Medina rodolfo.medina at gmail.com
Sun Sep 23 16:37:20 CEST 2007


Rodolfo Medina wrote:

>> With plain TeX:
>> I wish to have something like that:
>>
>>
>> ------------------------->%--------------------------------------------------
>>
>> 1. This is the title of paragraph 1, which is very very long, so I don't know
>>   how to handle it with TeX.
>>
>> 12. This is  the title of  paragraph 12, which has  a  different indentation
>>    because of `12' in place of `1'.
>>
>> -------------------------%<--------------------------------------------------
>>
>>
>> Can anybody suggest how to get that?  The title should be flush right;
>> whereas
>> the number should be flush left; and the same glue should be between the
>> number
>> and the title.



"Stanislaw Romanski" <s.romanski at datos.pl> writes:

> ========================================================================
> % -------------------------------------------
> \def\myTitle#1#2{{\setbox0=\hbox{#1. }\leavevmode\hangindent\wd0\hangafter 1
> \box0 #2.\par}}
> % -------------------------------------------
> \hsize = 3in
> \parindent 0pt
>
> \newcount\paragraphCount
> \paragraphCount = 0
>
> \advance\paragraphCount by 1
>
> xxxxxxxxxx
>
> \myTitle{\the\paragraphCount}{This is the title of paragraph 1, which is very
> very long, so I don't know
>   how to handle it with TeX}
> xxxxxxxxxx
>
> \paragraphCount = 12
> \myTitle{\the\paragraphCount}{This is  the title of  paragraph 12, which has a
> different  indentation
>    because of `12' in place of `1'}
> xxxxxxxxxx
> \bye
>
> ========================================================================
>
> - no interference with another use of \box0
> - first parameter has not to be a \count
> ;-)


Fantastic, this seems to work fine. :)
Thanks indeed,
Rodolfo



More information about the texhax mailing list