3

I am trying to use the first bit of code in this answer to use paragraph like a subsubsubsection.

The problem is that there is a conflict with sectsty - without this the output is exactly as in @GonzaloMedina's answer. When I add sectsty the line break between the paragraph title and the following text disappears, as in the image below. How can I reinsert the line break?

sectsty issue

\documentclass{article}

%Sectioning and headings
%------------------------

\usepackage{titlesec}

\usepackage{sectsty}          % put section headings in sans-serif font
\setcounter{secnumdepth}{4}

\titleformat{\paragraph}{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}

\begin{document}

some text
\section{Section}
some text
\subsection{Subsection}
some text
\subsubsection{Subsubsection}
some text
\paragraph{Paragraph}
some text

\end{document}
  • Could provide a link to GonzaloMedina's answer? – 1010011010 Oct 9 '14 at 12:33
  • @1010011010 I did! In the first line of my question. – FionaSmith Oct 9 '14 at 12:35
  • What is my answer missing? I could give you an in-depth expansion process for your macros, but since titlesecs macros are absurdly complicated it will probably not contribute to your understanding... – 1010011010 Oct 11 '14 at 8:30
  • @1010011010 your answer isn't missing anything - I was just away from the office for a few days doing things in the real world! – FionaSmith Oct 13 '14 at 8:23
2

With titlesec being the package with the more complicated macros (thus more fail safe switches to determine whether or not a package is loaded), as a rule of thumb I always load these packages at the latest.

The following produces the correct indentation and a line break:

http://i.imgur.com/qy2M339.png?1

\documentclass{article}

%Sectioning and headings
%------------------------

\usepackage{sectsty}          % put section headings in sans-serif font
\setcounter{secnumdepth}{4}

\usepackage{titlesec}

\titleformat{\paragraph}{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}

\begin{document}

some text
\section{Section}
some text
\subsection{Subsection}
some text
\subsubsection{Subsubsection}
some text
\paragraph{Paragraph}
some text
%

\end{document}
  • Thanks - should have thought of swapping things around really... that sort of thing often catches me out. It would be great if there was some kind of package checker built into latex processors that warned you of common conflicts, but I suspect there would be so many that it would be hard to keep it up to date! – FionaSmith Oct 13 '14 at 8:26
  • PS the comment now seems to have gone but if it was you asking about the sans-serif font, presumably you realised I had just removed that line to create a MWE but failed to remove the comment on reason for package load – FionaSmith Oct 13 '14 at 8:32
  • @FionaSmith Yeah, I guessed so. If this ends up causing trouble (somehow), just update your code and I'll take a look again. ;-) – 1010011010 Oct 13 '14 at 8:47

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.