1

My MWE:

\documentclass[a4paper,12pt]{article}
\usepackage{showframe}
\usepackage{lipsum}

\usepackage{geometry}
\geometry{paper=a4paper}                
\geometry{bindingoffset=1.5cm,hmargin={1.5cm,1.5cm},vmargin={1cm,1cm}}
\geometry{includehead=true,headheight=3cm,headsep=1cm}  
\geometry{includefoot=false}

\begin{document}
\section{Section}
\lipsum[1-1]
\subsection{Subsection}
\lipsum[1-1]
\subsubsection{Subsubsection}
\lipsum[1-1]
\end{document}

text output: (bindingoffset 1.5cm + left margin 1.5cm; 3cm total left margin) enter image description here

desired output: enter image description here

Is possible to make section and text under sections/subsections etc indented by 2 cm?

edit With @Bernard help: enter image description here Is possible to move numbering left; like in my desired output?

EDIT 2 (also related to question Combining two macros) Using @Bernard, @ereg and @Henri Menke code and @cfr advice.

CODE

\documentclass[a4paper,12pt]{article}
\usepackage{lipsum}

\usepackage[showframe]{geometry}
\geometry{paper=a4paper}
\geometry{bindingoffset=1.5cm,hmargin={3.5cm,1.5cm},vmargin={1cm,1cm}}
\geometry{includehead=true,headheight=3cm,headsep=1cm}
\geometry{includefoot=false}
\usepackage{changepage}
\usepackage{titlesec}
\usepackage{etoolbox} 
\usepackage[ampersand]{easylist}
\usepackage{xcolor}

\renewcommand{\contentsname}{\hfill \textit{Table of Contents}}     %%Table of contents name change
\renewcommand{\listfigurename}{\hfill \textit{List of Figures}}     %%List of figures name change
\renewcommand{\listtablename}{\hfill \textit{List of Tables}}       %%List of tables name change
\newcommand\tocloflot{%
    \clearpage
    \tableofcontents
    \addtocontents{toc}{\hrule height1pt}
    \clearpage
    \csname phantomsection\endcsname
    \listoffigures
    \addtocontents{lof}{\hrule height1pt\par\bigskip}
    \addcontentsline{toc}{section}{List of Figures}
    \clearpage
    \csname phantomsection\endcsname
    \listoftables
    \addtocontents{lot}{\hrule height1pt\par\bigskip}
    \addcontentsline{toc}{section}{List of Tables}
    \clearpage
}

\titleformat{\section}{\Large\bfseries}{\parbox{2cm}{\thesection}}{-0.5pt}{}
\titleformat{\subsection}{\large\bfseries}{\parbox{2cm}{\thesubsection}}{-0.5pt}{}
\titleformat{\subsubsection}{\normalsize\bfseries}{\parbox{2cm}{\thesubsubsection}}{-0.5pt}{}
\titlespacing*{\section}{-2cm}{0.6cm}{0.6cm}
\titlespacing*{\subsection}{-2cm}{0.4cm}{0.4cm}
\titlespacing*{\subsubsection}{-2cm}{0.2cm}{0.2cm}

\def\defineEasylist#1#2{\expandafter\def\csname 
    Easylist@style@#1\endcsname{\NewList(#2)}}
\def\Easylist{\futurelet\next\doEasylist}
\def\doEasylist{\ifx[\next\expandafter\doEasylistone\else\expandafter
    \doEasylistnop\fi}
\def\doEasylistone[#1] 
{\begin{easylist}\if\relax\detokenize{#1}\relax\else\csname 
        Easylist@style@#1\endcsname\fi}
    \def\doEasylistnop{\begin{easylist}\NewList}
        \def\endEasylist{\end{easylist}}

    \defineEasylist{lowercasestyle} 
    {Numbers=l,Hang=true,FinalSpace=0.2cm,Align=fixed, 
        Margin1=0.5cm,Margin2=1.5cm,Margin3=2.5cm,Margin4=3.5cm, 
        Margin5=4.5cm,Margin6=5.5cm,Margin7=6.5cm,Space=0.15cm,Space*=0.15cm}

    \defineEasylist{uppercasestyle} 
    {Numbers=L,Hang=true,FinalSpace=0.2cm,Align=fixed, 
        Margin1=0.5cm,Margin2=1.5cm,Margin3=2.5cm,Margin4=3.5cm, 
        Margin5=4.5cm,Margin6=5.5cm,Margin7=6.5cm,Space=0.15cm,Space*=0.15cm}

    \defineEasylist{romanlowercasestyle} 
    {Numbers=r,Hang=true,FinalSpace=0.2cm,Align=fixed, 
        Margin1=0.5cm,Margin2=1.5cm,Margin3=2.5cm,Margin4=3.5cm, 
        Margin5=4.5cm,Margin6=5.5cm,Margin7=6.5cm,Space=0.15cm,Space*=0.15cm}

    \defineEasylist{romanuppercasestyle} 
    {Numbers=R,Hang=true,FinalSpace=0.2cm,Align=fixed, 
        Margin1=0.5cm,Margin2=1.5cm,Margin3=2.5cm,Margin4=3.5cm, 
        Margin5=4.5cm,Margin6=5.5cm,Margin7=6.5cm,Space=0.15cm,Space*=0.15cm}

    \defineEasylist{bullet}{Hide=100,Hang=true,FinalSpace=0.5cm,Align=fixed, 
        Margin1=0.5cm,Margin2=1.5cm,Margin3=2.5cm,Margin4=3.5cm, 
        Margin5=4.5cm,Margin6=5.5cm,Margin7=6.5cm,Space=0.15cm,Space*=0.15cm,
        Style1*=\textbullet\hspace{0.25cm},Style2*=$\circ$\hspace{0.25cm},
        Style3*=$\star$\hspace{0.25cm},Style4*=$\mp$\hspace{0.25cm}}

\begin{document}
        \tocloflot
        \section{Section Section Section Section Section Section Section Section Section}
        \lipsum[1]

        \begin{Easylist}[bullet]
            & dog
            && cat
            &&& rabbit
        \end{Easylist}
        \par\bigskip
        \begin{Easylist}[lowercasestyle]
            & dog
            && cat
            &&& rabbit
        \end{Easylist}
        \par\bigskip
        \begin{Easylist}[romanuppercasestyle]
            & dog
            && cat
            &&& rabbit
        \end{Easylist}
        \par\bigskip
        \begin{Easylist}[romanlowercasestyle]
            & dog
            && cat
            &&& rabbit
        \end{Easylist}

        \subsection{Section Section Section Section Section Section Section Section Section Section Section Section Section Section Section Section Section Section}
        \lipsum[1]
        \subsubsection{Section Section Section Section Section Section Section Section Section Section Section Section Section Section Section Section Section Section}
        \lipsum[1]

\end{document}

enter image description here

4
  • Could you post a full, yet minimal code that produces your output? With the code you show, all texts should start at the left margin, so there must be something else. – Bernard Jul 17 '18 at 8:27
  • @Bernard This black rectangle is a page border, not page margins (just info). Text is starting as I defined 3cm from left margin. I want to add 2 cm indentation as shown in desired output. My MWE is page margin settings which I post + some random text. In my original document I have page borders and table in header. – Beginner Jul 17 '18 at 8:38
  • Oh! I see now. Did you try \begin{adjustwidth{2cm}{} ... \end{adjustwidth}, from changepage? – Bernard Jul 17 '18 at 8:47
  • @Bernard I have posted my MWE + output with \begin{adjustwidth{2cm}{} ... \end{adjustwidth}; Is it possible to move numbering to the left, as shown at desired output? Thank you! – Beginner Jul 17 '18 at 9:16
4

Here is a solution with the adjustwidth environment from changepage and \titlespacing fromtitlesec. The latter command takes 3 arguments: a first argument to increase or decrease the left margin, the other two for the vertical spacing before and after the title. I incorporated this command at the very beginning of the adjustwidth environment, so as to not interfere with the general settings of the document. If this has to be repeated several times in your document, you may consider declaring these modifications in your preamble, with \AtBeginEnvironment{adjustwidth}{...}.

\documentclass[a4paper,12pt]{article}
\usepackage{lipsum}

\usepackage[showframe]{geometry}
\geometry{paper=a4paper}
\geometry{bindingoffset=1.5cm,hmargin={1.5cm,1.5cm},vmargin={1cm,1cm}}
\geometry{includehead=true,headheight=3cm,headsep=1cm}
\geometry{includefoot=false}
\usepackage{changepage}
\usepackage{titlesec}

\begin{document}


\lipsum[11]
\begin{adjustwidth}{2cm}{}
\titleformat{\section}{\Large\bfseries}{\parbox{2cm}{\thesection}}{-0.5pt}{}
\titleformat{\subsection}{\large\bfseries}{\parbox{2cm}{\thesubsection}}{-0.5pt}{}
\titleformat{\subsubsection}{\normalsize\bfseries}{\parbox{2cm}{\thesubsubsection}}{-0.5pt}{}
\titlespacing{\section}{-2cm}{*3.5}{*2.}
\titlespacing{\subsection}{-2cm}{*3.25}{*1.5}
\titlespacing{\subsubsection}{-2cm}{*3.25}{*1.5}
\section{Section}
\lipsum[1]
\subsection{Subsection}
\lipsum[1]
\subsubsection{Subsubsection}
\lipsum[1]
\end{adjustwidth}

\end{document} 

enter image description here

Edit 1 :

Here is a code with the modifications using titlesec in the preamble:

\documentclass[a4paper,12pt]{article}
\usepackage{lipsum}

\usepackage[showframe]{geometry}
\geometry{paper=a4paper}
\geometry{bindingoffset=1.5cm,hmargin={1.5cm,1.5cm},vmargin={1cm,1cm}}
\geometry{includehead=true,headheight=3cm,headsep=1cm}
\geometry{includefoot=false}
\usepackage{changepage}
\usepackage{titlesec}
\usepackage{etoolbox} 
\AtBeginEnvironment{adjustwidth}{%
\titleformat{\section}{\Large\bfseries}{\parbox{2cm}{\thesection}}{-0.5pt}{}
\titleformat{\subsection}{\large\bfseries}{\parbox{2cm}{\thesubsection}}{-0.5pt}{}
\titleformat{\subsubsection}{\normalsize\bfseries}{\parbox{2cm}{\thesubsubsection}}{-0.5pt}{}
\titlespacing*{\section}{-2cm}{*3.5}{*2.}
\titlespacing*{\subsection}{-2cm}{*3.25}{*1.5}
\titlespacing*{\subsubsection}{-2cm}{*3.25}{*1.5}
}

\begin{document}

\lipsum[11]
\begin{adjustwidth}{2cm}{}
\section{Section}
\lipsum[1]
\subsection{Subsection}
\lipsum[1]
\subsubsection{Subsubsection}
\lipsum[1]
\end{adjustwidth}

\end{document}

Edit 2:

If have titles that fit on more than one line, and you want them to hang 2cm from the left margin, replace the last (empty) argument of \titleformat with a \parbox, like this:

\titleformat{\section}{\Large\bfseries}{\parbox[t]{2cm}{\thesection}}{-0.5pt}{\parbox[t]{\dimexpr\textwidth-2cm}}

and similarly for sub and subsubsections.

enter image description here

11
  • first of all, thank you. We had a little bit of missunderstanding, is it possible that numbering (1, 1.1, 1.1.1, etc.) from section/subsection/etc.. is aligned at left margin and data from section/subsection/etc.. is aligned with text (2cm from margin) ? Thank you in advance. :) – Beginner Jul 17 '18 at 10:39
  • 1
    @Beginner: Done! – Bernard Jul 17 '18 at 11:14
  • 1
    @Beginner: I've added a variant code for \titleformat which does what you want, if I've well understood. – Bernard Jul 18 '18 at 14:46
  • 1
    @Beginner: *n denotes a length of n ex, with a certain amount of stretchability/shrinkability (see more details at the top of p.5 of the documentation). – Bernard Jul 20 '18 at 8:38
  • 1
    It's hard to say without seeing the code you used. This is probably linked to the list parameters. Perhaps you should post a new question, with the relevant code. – Bernard Jul 20 '18 at 9:26

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.