Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I use the titlesec package for decoration sections and subsections. But i do not know how to change leftmargin or indent for this. Look at the picture, the green line is where i want to move the section.

I use this code

\documentclass[a4paper, 14pt]{extreport}
\usepackage{titlesec}

\titleformat{\section}{}{\thesection}{14pt}{}

enter image description here

share|improve this question
    
Welcome to TeX.SX! It would be very useful to add the code you have up to now. Is it the blue line? –  egreg Jun 1 '12 at 8:54
    
@egreg i added code –  mark Jun 1 '12 at 9:00
    
That code produces an error. –  egreg Jun 1 '12 at 9:05
    
but in texmaker this works without errors. –  mark Jun 1 '12 at 9:07
    
I don't think so. Please, make a complete example: only the class, the loading of titlesec and the relevant commands. –  egreg Jun 1 '12 at 9:13

1 Answer 1

up vote 3 down vote accepted

A layout as you'd like can be obtained by

\documentclass{report}
\usepackage{indentfirst}
\usepackage{titlesec}
\usepackage{lipsum}

\newlength{\normalparindent}
\AtBeginDocument{\setlength{\normalparindent}{\parindent}}

\titleformat{name=\section}[block]
  {\LARGE}
  {\hspace*{\normalparindent}\thesection}
  {1em}
  {}

\titleformat{name=\section,numberless}[block]
  {\LARGE}
  {}
  {0pt}
  {\hspace*{\normalparindent}}

\begin{document}

\section{Lorem Ipsum Dolor}
\lipsum[1]

\section*{Nam Dui Ligula}
\lipsum[2]

\end{document}

It's necessary to specify the numberless variant, otherwise the indentation would not be respected for unnumbered sections. Adjust the size (I used \LARGE) and the spacing between the number and the title (I used 1em).

The definition and setting of \normalparindent is necessary because the value of \parindent is not available (better, it's set to zero) when LaTeX is typesetting a section title.


enter image description here


Note. I don't like such a layout at all.

share|improve this answer
    
egreg thanks you. –  mark Jun 1 '12 at 9:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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