I am using the article
document class and have trouble with the \titlespacing
command of the titlesec
package (explicit).
I want to have more space before the \section
. MWE:
\documentclass[a4paper,12pt,fleqn,twoside]{article}
\usepackage[explicit]{titlesec}
\usepackage{varwidth}
\usepackage{xhfill}
\usepackage{parskip}
\titleformat{\section}[display]
{\Huge}{\filleft\thesection}{-2ex}
{\hspace*{\dimexpr-6em-10pt\relax}
\advance\hsize6em\advance\hsize10pt%
\rule[0.5ex]{6em}{1pt}\hspace{10pt}%
\begin{varwidth}{\textwidth}\raggedright#1\end{varwidth}%
\hspace{10pt}\xrfill[0.5ex]{1pt}%
}
\titlespacing{\section}{0cm}{8cm}{2cm}
\begin{document}
\section{abc}
abcbacbabcbabcbacbabcbabcbabcbac
\cleardoublepage
\section{def}
abcbacbabcbabcbacbabcbabcbabcbac
\end{document}
But I have trouble with the \titlespacing
command, it seems like it is getting overwritten by something.
Has it got to do with the explicit command of the titlesec package?
Another question:
With my current section heading style, is it possible to only enlarge the section number without enlarging the section text?
Best Answer
Read Enrico's comments above:
That should answer your first question. Coming to the second question, it is possible. I will show at least two ways.
Method -1:
Load
graphicx
package and use itsscalebox
macro like:Method - 2
Use an appropriate scalable font (like
lmodern
) and use\fontsize{55}{65}\selectfont\thesection
Full code:
You can hard code the vertical distance: