I am looking to make a tight black box around my chapter titles, ideally only 1pt
of margin on each side. So far, my best results have been with soul
:
However, you'll notice that there is too much margin at the bottom. Also, the highlight gets repeated at the top of each odd page:
What is the clever way to do this stuff? I don't mind using something else than soul
, it just seemed like a good solution.
MWE below. Please note that you'll need the Mikodacs font (or perhaps any TTF font?) in FONTLOCATION
.
\documentclass[book,dvipsnames]{memoir}
\usepackage{xcolor}
\usepackage{fontspec}
\usepackage{anyfontsize}
\usepackage{soul}
\sethlcolor{black}
%% Change height of highlight
\makeatletter
\def\SOUL@hlpreamble{%
\setul{}{2ex}%
\let\SOUL@stcolor\SOUL@hlcolor
\SOUL@stpreamble
}
\makeatother
\newfontfamily{\archivo}[Path=/FONTLOCATION]{Mikodacs.ttf}
\usepackage{lipsum} %% For dummy text
%% Chapterstyle
\makechapterstyle{lucknerto}{%
\setlength{\beforechapskip}{-2\onelineskip}%
\setlength{\afterchapskip}{2\onelineskip}%
\renewcommand*{\printchaptername}{}%
\renewcommand*{\chapternamenum}{}%
\renewcommand*{\chapnumfont}{\normalfont\large\sffamily\bfseries}%
\renewcommand*{\afterchapternum}{}%
\renewcommand{\printchaptertitle}{\centering\archivo\color{White}\fontsize{23}{27.6}\selectfont\MakeUppercase}
}
\chapterstyle{lucknerto} %% enable
%% Pagestyle
\makepagestyle{luckner}%
\makeevenhead{luckner}{}{\small{{\MakeUppercase{book title}}}}{}
\makeoddhead{luckner}{}{\small{{\MakeUppercase{\leftmark}}}}{}
\makeevenfoot{luckner}{\large{\thepage}}{}{}
\makeoddfoot{luckner}{}{}{\large{\thepage}}
\pagestyle{luckner} %% enable
\begin{document}
\chapter{\hl{Foobar}}
\lipsum[1-20]
\end{document}
tcolorbox
can provide nice (and tight) boxes\begin{tcolorbox}[colframe=black] \chapter{Foobar} \end{tcolorbox}
... but that ruins the pagestyle.