3

I am writing a document with different indent (spacing) in all section (0.3in), all subsection (0.8in) and all subsubsection (1.4in).

Only the first line in each paragraphs should be indented but the left margin is not change.

\documentclass[12pt,a4paper,oneside]{book}      
\usepackage{geometry}   
\usepackage{lipsum}                     
\geometry{letterpaper}                           
\usepackage{multirow} 

\usepackage{fontspec}

\usepackage{xunicode}

\usepackage{xltxtra}

\defaultfontfeatures{Mapping=tex-text}

\setmainfont{Times Roman}   

\usepackage{indentfirst}

\usepackage{titlesec}

\usepackage{titletoc}

\setcounter{secnumdepth}{4}

\titlespacing{\subsection}{1.1in}{1.5ex plus .1ex minus .2ex}{1pc}

\titlespacing{\subsubsection}{1.4in}{1.5ex plus .1ex minus .2ex}{1pc}

\begin{document}

\section{First}

\lipsum[1]

\subsection{Second}

\lipsum[2]

\end{document} 

result

But This is what I need is

2

One simple solution is change \parindent after \section{}. This can be done automatically redefining \section{}. Example:

\documentclass{article}
\usepackage{indentfirst} 

% redefining sections
\let\oldsection\section
\renewcommand{\section}[1]{\oldsection{#1}\setlength{\parindent}{.3in}}

\begin{document}
\section{A section}
I am writing a document with different indent (spacing)
in section (0.3in), subsection (0.8in) and subsubsection (1.4in). 
\end{document}

For \subsection and \subsbsection the procedure is exactly the same.

I assumed that you do not need optional arguments in sectioning commands. Otherwise see Renewdefine section with additional argument

Note that paragraphs after a title are not indented by default in English. If you want indent also the firs paragraph, use also the indentfirst package as in the example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.