GeneralSubsection content margin

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Arxas
Posts: 4
Joined: Fri Oct 22, 2010 9:22 pm

Subsection content margin

Post by Arxas »

I would like to change left margin of subsection content. Now it looks like this:

Image

but I want it to look like that:

Image

Is there an easy way to do this?

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

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

Subsection content margin

Post by gmedina »

Hi,

According to your description you need to change the indentation for list items; you could use the enumitem package; an example:

Code: Select all

\documentclass{article}
\usepackage{enumitem}

\begin{document}

\section{Test section}

\subsection{A test subsection with a really long title that spanns two lines}
\begin{enumerate}[leftmargin=8.4em,label=\textbf{Tabela\ \arabic*.}:]
  \item First item.
  \item Second item.
  \item Third item.
\end{enumerate}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Arxas
Posts: 4
Joined: Fri Oct 22, 2010 9:22 pm

Re: Subsection content margin

Post by Arxas »

Thank you for answer, but you misunderstood me. I would like to have bigger left margin for everything that subsection contains.
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Subsection content margin

Post by gmedina »

Then you could use the adjustwidth environment from the changepage package:

Code: Select all

\documentclass{article}
\usepackage{changepage}
\usepackage{lipsum}% just to generate filler text

\begin{document}

\section{Test section}
\lipsum[1]

\begin{adjustwidth}{-1cm}{0pt}
\subsection{A test subsection with a really long title that spanns two lines}
\begin{enumerate}
  \item First item.
  \item Second item.
  \item Third item.
\end{enumerate}
\end{adjustwidth}

\lipsum[1]
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Subsection content margin

Post by localghost »

Perhaps a general approach with titlesec can help. It shifts the headings numbers into the margin. The type area is accommodated with geometry. See sample code below.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[bindingoffset=2cm,includeheadfoot,margin=2cm]{geometry}
\usepackage[bf,pagestyles,raggedright]{titlesec}
\usepackage{blindtext}

% Setup for page layout (titlesec)
\newpagestyle{main}{%
  \headrule
  \sethead[\thepage][][\thesubsecton\quad\subsectiontitle]{\thesection\quad\sectiontitle}{}{\thepage}
  \setfoot[][][]{}{}{}
}
\widenhead*{2cm}{0cm}
\pagestyle{main}

% Setup for headings (titlesec)
\titleformat{\section}{\normalfont\Large\bfseries}{\makebox[30pt][r]{\thesection}}{15pt}{}
\titleformat{\subsection}{\normalfont\large\bfseries}{\makebox[30pt][r]{\thesubsection}}{15pt}{}
\titleformat{\subsubsection}{\normalfont\normalsize\bfseries}{\makebox[30pt][r]{\thesubsubsection}}{15pt}{}
\titlespacing*{\section}{-45pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
\titlespacing*{\subsection}{-45pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\titlespacing*{\subsubsection}{-45pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}

\begin{document}
  \blinddocument
\end{document}
This affects all headings. Note that the blindtext package is only used for producing the dummy document thus is not part of the solution.


Best regards and welcome to the board
Thorsten
Post Reply