Try the following. It would not work for all the options of memoir
, because it has two optional arguments for the \chapter
command.
\documentclass{book}
\makeatletter
\let\oldchapter\chapter
\newcommand\chaphead{}
\renewcommand\chapter{%
\@afterindentfalse
\secdef\@mychapter\@schapter}
\def\@mychapter[#1]#2{%
\addcontentsline{toc}{chapter}{#1}%
\chaptermark{#1}%
\addtocontents{lof}{\protect\addvspace{10\p@}}%
\addtocontents{lot}{\protect\addvspace{10\p@}}%
\renewcommand\chaphead{#2}}
\def\chaptermark#1{%
\markboth {\MakeUppercase{#1}}{}}%
\def\sectionmark#1{%
\markright{\MakeUppercase{%
\ifnum \c@secnumdepth >\z@
\arabic{section}. \ %
\fi
#1}}}
\renewcommand\thesection{\chaphead~\arabic{section}.}
\makeatother
\begin{document}
\tableofcontents\clearpage
\chapter{First chapter}
\section{First section}
\section{Second section}
\end{document}
Read Enrico's comments above:
Vertical space at the beginning of pages is removed.
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 its scalebox
macro like:
\titleformat{\section}[display]
{\Huge}{\filleft\scalebox{2}{\thesection}}{-2ex} %% here
{\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}%
}
Method - 2
Use an appropriate scalable font (like lmodern
) and use \fontsize{55}{65}\selectfont\thesection
\titleformat{\section}[display]
{\Huge}{\filleft\fontsize{55}{65}\selectfont\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}%
}
Full code:
\documentclass[a4paper,12pt,fleqn,twoside]{article}
\usepackage[explicit]{titlesec}
\usepackage{varwidth}
\usepackage{xhfill}
\usepackage{parskip}
\usepackage{lmodern}
%\usepackage{graphicx}
%\titleformat{\section}[display]
% {\Huge}{\filleft\scalebox{2}{\thesection}}{-2ex} %% here
% {\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}%
% }
\titleformat{\section}[display]
{\Huge}{\filleft\fontsize{55}{66}\selectfont\thesection}{-2ex} %% here
{\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}
You can hard code the vertical distance:
\titleformat{\section}[display]
{\Huge}{\vspace*{20pt}\filleft\fontsize{55}{66}\selectfont\thesection}{-2ex} %% here added \vspace*{20pt}
{\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}%
}
Best Answer
There's a
numberless
key (to be used withname
) that does the job: