Suppose I have the following custom package where I have my various titlesec
setups defined:
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mytitles}[2018/06/01 Custom Titles Package]
\RequirePackage{titlesec}
\DeclareOption{titlesone}{
\titleformat{\chapter}%
[display]{}{\itshape\huge\thechapter}{0pt}{}[]
\titleformat{\section}%
[hang]{\Large\itshape}{\thesection}{1em}{}[]
}
\DeclareOption{titlestwo}{
\titleformat{\chapter}%
[display]{}{\bfseries\huge\thechapter}{0pt}{}[]
\titleformat{\section}%
[hang]{\Large\itshape}{\thesection}{1em}{}[]
}
\DeclareOption{titlesthree}{
\titleformat{\chapter}%
[display]{}{\itshape\huge\thechapter}{0pt}{}[]
\titleformat{\section}%
[hang]{\Large\bfseries}{\thesection}{1em}{}[]
}
\DeclareOption{titlesfour}{
\titleformat{\chapter}%
[display]{}{\bfseries\huge\thechapter}{0pt}{}[]
\titleformat{\section}%
[hang]{\Large\bfseries}{\thesection}{1em}{}[]
}
\ExecuteOptions{titlesone}
\ProcessOptions\relax
\endinput
And then:
\documentclass[12pt, a4paper]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[american]{babel}
\usepackage{microtype}
\usepackage{libertine}
\usepackage{lipsum}
\usepackage[titlestwo]{mytitles}
\begin{document}
\chapter{Test Chapter}
\section{Test Section}
\subsection{Test Subsection}
\lipsum
\end{document}
The problem: Suppose I have five different chapter
definitions, and five different section
definitions. Further suppose that I am like to use any combination. With my extremely limited knowledge, the way I do is to \DeclareOption
for each combination. (In this case, twenty five.) Would it be possible to declare options for chapter
and section
separately, and load them with something like: \usepackage[chapteroptionthree, sectionoptionfour]{mytitles}
?