[texhax] LaTeX programming question

Uwe Lück uwe.lueck at web.de
Wed May 14 21:37:12 CEST 2008


At 06:30 24.04.08, Joshua Harold Shrader wrote:
>
>I would like to be able to type a document where I can flag certain 
>paragraphs to be treated specially.  For example:
>
>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
>This paragraph is normal
>
>\begin{special1}
>   I would like this paragraph, when typeset, to appear with a "(P1)" at 
> the very beginning of the paragraph.  If this paragraph is broken across 
> pages, I would like the "(P1)" to appear as the first couple characters 
> on the second page where the paragraph is broken.  Also, on any page that 
> contains a portion of this paragraph, I would like the header and footer 
> to say "Paragraph Type 1".
>\end{special1}
>
>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
>I'm not very familiar with programming with LaTeX.  I am currently reading 
>through The LaTeX Companion.  I do have significant programming 
>background, but the TeX/LaTeX syntax is not like anything I've ever seen 
>before.  I'm not even sure if something like this is possible.

As Tom Sgouros has answered, this is really hard.
The header/footer thing is probably easy, just as Tom Sgouros
suggested. A paragraph identifier as the first string in the first
line of the page is really very very, needing knowledge that
(AFAIK) is difficult to access.

I guess that Donald Arseneau's

     http://ctan.tug.org/pkg/fwlw

("first word/ last word") can be used with an additional trick.
(Attach a string to that first word, with a negative \hspace.)

-- Uwe.

P.S.: lineno.sty perhaps gives some ideas, together with
The TeXbook and the LaTeX source about output routines.
A not released version of lineno.sty is near putting that
identifier into the margin. 



More information about the texhax mailing list