Page LayoutRemove first-line indent from first paragraph of every page

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
ubpgs
Posts: 5
Joined: Tue Jul 14, 2009 1:59 pm

Remove first-line indent from first paragraph of every page

Post by ubpgs »

I am currently working on a document that is designed to follow a set of layout guidelines but have found myself stuck when it comes to one of them.
All paragraphs should have a first-line indent of 13pt with the exception of …
  • … a new paragraph starting as the first text on a new page.
  • … a paragraph after a quote/figure/table.
I have been able to redefine the quote environment to remove the indentation on the following paragraph by also redefining the \end command and using the commands \@afterindentfalse and \everypar. A similar solution should be possible if one can find a command that is executed right before the start of the text on a new page. Thus far I have been unable to find a command that is in the same context however which means that neither changes to \parindent or \everypar will effect the actual text.

I hope you can help me find a command in the same context as the page text to which I can add the changes with \@afterindentfalse and \everypar or inform me how to go about to find this command. Is there perheps a better solution (which does not involve manually inserting \noindent in the source)?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Remove first-line indent from first paragraph of every page

Post by localghost »

I think the everypage package could be useful. It would allow to add the \noindent command to the stack. A manual way to prevent indentation after the mentioned environments would be to add this command right before the beginning of the following paragraph.

If this all works, you are welcome to post the complete solution including your own approaches.


Best regards and welcome to the board
Thorsten
ubpgs
Posts: 5
Joined: Tue Jul 14, 2009 1:59 pm

Remove first-line indent from first paragraph of every page

Post by ubpgs »

As illustrated by the following example it seems that the commands used by the everypage package does not allow changes to the same conext as the page text. (I've also tried using the commands: \@begindiv \@outputpage \@texttop \@parboxrestore. \@texttop and \@parboxrestore will render textual content within the same box but still not the same context as \noindent and definitions will have no effect on the following paragraph.)

Code: Select all

\documentclass{minimal}
\makeatletter
\let\tmp\@begindvi
\def\@begindvi{\everypar{Changed everypar: }}
% The change using \everypar will not give any result to the page text

\makeatother
\begin{document}
\everypar{This text should change from page 2: }
Paragraph text. Lorem ipsum dicam utroque aliquando mel ut, ex sea odio 
repudiare. In regione diceret apeirian est, nemore laoreet salutandi id 
qui. Est et dolore quodsi similique, ad sit alii docendi volutpat, quo 
eius adhuc mentitum at. Nec affert debitis adversarium at, his sint 
torquatos assueverit at, et virtute fabellas pri. Omnesque nominavi 
reformidans ei vis, eu pro veritus commune convenire, nostrud epicurei 
ullamcorper ne eam.

\clearpage % Manual page breaks will not be present in general

Paragraph text on a new page. Lorem ipsum dicam utroque aliquando mel ut, 
ex sea odio repudiare. In regione diceret apeirian est, nemore laoreet 
salutandi id qui. Est et dolore quodsi similique, ad sit alii docendi 
volutpat, quo eius adhuc mentitum at. Nec affert debitis adversarium at, 
his sint torquatos assueverit at, et virtute fabellas pri. Omnesque 
nominavi reformidans ei vis, eu pro veritus commune convenire, nostrud 
epicurei ullamcorper ne eam.

Second paragraph. Lorem ipsum dicam utroque aliquando mel ut, ex sea odio 
repudiare. In regione diceret apeirian est, nemore laoreet salutandi id 
qui. Est et dolore quodsi similique, ad sit alii docendi volutpat, quo 
eius adhuc mentitum at. Nec affert debitis adversarium at, his sint 
torquatos assueverit at, et virtute fabellas pri. Omnesque nominavi 
reformidans ei vis, eu pro veritus commune convenire, nostrud epicurei 
ullamcorper ne eam.
\end{document}
If there is documentation of these low level commands used while rendering the pages, it would be a great help if someone could point me to a resource.

I will surely post my solution when it's completed. Thank you.
ubpgs
Posts: 5
Joined: Tue Jul 14, 2009 1:59 pm

Remove first-line indent from first paragraph of every page

Post by ubpgs »

Through some investigation I've found that the first paragraph of a page seems to be typeset before the new page is started. Inserting the command \the\page within the paragraph will bring this issue to light, as the page number returned is still that of the previous page.

:?: Is there any command to tell TeX to remake a paragraph before it's flushed to output?

Other than this I guess one could dump information about which paragraphs are being pushed to the next page in the aux-file, but this may potentially end up forcing the author to recompile the document as many times as there are pages in the document.
Post Reply