I decided to write my first own latex class that has to reproduce template used for some intenal type of documents made in word. I cannot find how to do one thing. In the template, all standard text (as well as lists etc.) are slightly intended, while heading remain not intended. You can do it with a hangindent, but only for one paragraph. How to define in my own class, that such a behaviour is standard for all the normal text?

I would not like to use any external classes...

  • 1
    Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It is considered a lot better to put in some code that will compile, as it makes it a lot easier for us to copy it into our text editor and work with it, and see exactly what it is you are trying to do.
    – hpesoj626
    Commented Oct 29, 2012 at 5:51
  • 1
    It's the other way around: the section headers should have a negative indentation.
    – egreg
    Commented Oct 29, 2012 at 11:55

2 Answers 2


Here is a partial solution. It uses How can I change the margins for only part of the text? to indent all the text, and Customizing indentation in section and subsection headings to adjust the section headings so that they are not indented (required the titlesec package). Here is a before and after comparrison:

Before: enter image description here

After: enter image description here


  • I labelled this as partial only because I could not unindent the section headings without the use of the titlesec package. One of the following should worked but I do not know why they do not:




    I have posted a follow-up question to see why this is occurring: Unindent section headings.

    There is also a slight vertical spacing issue with the section heading but I think that is related to messing with the section heading as it is more apparent with my failed attempts to unindent the section headings.

  • The showframe package was used just to show the page margins.

  • The lipsum package was used just to provide dummy text.




%% https://tex.stackexchange.com/questions/588/how-can-i-change-the-margins-for-only-part-of-the-text

%% Not sure why these did not work

%% https://tex.stackexchange.com/questions/25082/customizing-indentation-in-section-and-subsection-headings

Here is a list:
    \item First item
    \item Second item
\section{Section Name}
  • Thanks! This is exactly what I need. However, there is a small problem with my custom section heading and the indentation. If The section heading spans over more then one line, the second line of the heading is as intended as the normal text: imgur.com/5CDli.
    – LWP
    Commented Oct 29, 2012 at 8:03
  • Uhm, I am not sure how should I properly insert the code in the comment, but it is: \renewcommand{\section}{\@startsection {section}% % the name {1}% % the level {-5mm}% % the indent {-\baselineskip}% % the before skip {0.5\baselineskip}% % the after skip {\large\color{red}\uppercase}% } % the style \setcounter{secnumdepth}{0}
    – LWP
    Commented Oct 29, 2012 at 8:06
  • For that you should refer to the follow up question: Unindent section headings. Commented Oct 29, 2012 at 17:29
  • OK, so far I pasted \def\@seccntformat#1{\protect\hspace*{-\LeftMargin}{\csname the#1\endcsname\quad}} in my class and it does not change anything. But I am a complete beginner in terms of latex classes writing, so I guess I need to get some more reading...
    – LWP
    Commented Oct 30, 2012 at 2:43
  • That should work. Perhaps you need to surround it with a \makeatletter, \makeatother. You don't this is package files, but perhaps you do in .cls files. Commented Oct 30, 2012 at 3:06

I don't know if I fully understand your question. A minimal working example as I have indicated in my comment will greatly aid in understanding your problem.

Do you want to remove all indentations? Then parskip package is what you are looking for. Look at Is there an easy way to have my whole document with a space between paragraphs rather than indentation?. Just write


in your preamble.

Do you want your first paragraphs indented? Then use the package indentfirst by writing


in your preamble.

If you want your class to load one of the two packages as your case may be, then write one of




in your .cls file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .