8

How do you keep the first paragraph from being indented, even when indentation is off, when using section titles in the margin?

I'm pretty new to LaTeX, but I thought I was getting pretty good at it, until I hit this problem I can't seem to resolve. I want block paragraphs, no indent, with section and subsection titles in the outer margin (in the memoir class.) By default, there's not supposed to be an indent in the first paragraph after a section title, anyways, but when I use titles in the margin, there's a 1 em indent for the first paragraph in a section, but not in subsections or sub-subsections, even though they use the same settings.

I thought this was related to this question about almost the same issue in memoir, but the answer didn't work. Adding \setbeforesecskipwith either a negative or positive value, or tweaking the \setsecindent (I started with [0em]) simply doesn't fix the problem.

\documentclass[12pt,a5]{memoir}
\usepackage{lipsum}

\semiisopage%  a default margin layouts

% fix margin notes

\setmarginnotes{3em}{0.2\textwidth}{2\onelineskip}

%% No numbered sections

\setcounter{secnumdepth}{0}

%% Section Names in margin

 \newcommand{\marginhead}[1]{%
   \marginpar{\bfseries\centering #1}}

%% set section, subsection and subsubsection headers
%% all the same, small bold text

\setsecindent{-1em}
\setbeforesecskip{-2em}
\setaftersecskip{0em}
\setsecheadstyle{\small\marginhead}

\setsubsecindent{0em}
\setaftersubsecskip{0em}
\setsubsecheadstyle{\small\marginhead}

% etc.

%% Paragraph styles
%%
%% no indent, skip line instead

\abnormalparskip{\baselineskip}
\setlength{\parindent}{0pt}

\checkandfixthelayout

\begin{document}

\section{First Section}
\lipsum[1]
\subsection{First Subsection}
\lipsum[1]
\section{Second Section}
\lipsum[1]
\subsection{Second Subsection}
\lipsum[1]
\subsection{Third Subsection}
\lipsum[1]

\end{document}
6

Setting the \setafterXskip parameters to a non-zero value (even to a non-detectable 1sp as in my code below) fixes the problem:

\documentclass[12pt,a5]{memoir}
\usepackage{lipsum}
\usepackage{marginnote}

\semiisopage%  a default margin layouts

% fix margin notes

\setmarginnotes{3em}{0.2\textwidth}{2\onelineskip}

%% No numbered sections

\setcounter{secnumdepth}{0}

%% Section Names in margin

 \newcommand{\marginhead}[1]{%
   \marginnote{\bfseries\centering #1}}

%% set section, subsection and subsubsection headers
%% all the same, small bold text

\setsecindent{-1em}
\setbeforesecskip{-2em}
\setaftersecskip{1sp}
\setsecheadstyle{\small\marginhead}

\setsubsecindent{0em}
\setaftersubsecskip{1sp}
\setsubsecheadstyle{\small\marginhead}

% etc.

%% Paragraph styles
%%
%% no indent, skip line instead

\abnormalparskip{\baselineskip}
\setlength{\parindent}{0pt}

\checkandfixthelayout

\begin{document}

\section{First Section}%
\lipsum[1]
\subsection{First Subsection}
\lipsum[1]
\section{Second Section}
\lipsum[1]
\subsection{Second Subsection}
\lipsum[1]
\subsection{Third Subsection}
\lipsum[1]

\end{document}

A portion of the result:

enter image description here

I changed \marginpar to \marginnote from the marginnote package.

  • But why? (I got this far too...) – Alan Munn Mar 11 '15 at 22:24
  • Marginnote is the only difference to the aforementioned question in my comment above. No dupe i think. – Johannes_B Mar 11 '15 at 22:25
  • @AlanMunn I'm asking myself the exact same question. Perhaps this should be a comment and not an answer until the reason has been found? – Gonzalo Medina Mar 11 '15 at 22:25
  • 1
    @Johannes_B Ahm, then this is a duplicate? On a second thought, I'd like to keep this one open and see if someone can come up with the reason for the problem and why a 1sp solves it. What do you think? – Gonzalo Medina Mar 11 '15 at 22:27
  • Hidden in the comment section: Remove space below section in memoir – Johannes_B Mar 11 '15 at 22:30

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.