GeneralHow to automatically indent section + all corresponding txt?

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
mansniks
Posts: 9
Joined: Tue Jul 08, 2008 8:51 pm

How to automatically indent section + all corresponding txt?

Post by mansniks »

Hello here,
I think, subject describes the problem. I mean - it all together and automatically.
Thank you!

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

How to automatically indent section + all corresponding txt?

Post by gmedina »

One possibility, using some features from the titlesec package:

Code: Select all

\documentclass{article}
\usepackage{titlesec}
\usepackage{lipsum}

\newenvironment{myindentpar}[1]%
{\begin{list}{}%
         {\setlength{\leftmargin}{#1}}%
         \item[]%
}
{\end{list}}

\titlespacing{\section}{1cm}{*4}{*1.5}

\begin{document}

\section{First section}
\begin{myindentpar}{1cm}
  \lipsum[1]
\end{myindentpar}
text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text

\end{document}
Notice that the argument of the myindentpar environment equals the value of the first argument of the \titlespacing command.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply