1

Basically I want to imitate this.

stacked section with numbered paragraphs

On the right page the section marker should be oriented the opposite way.

I think it's possible to achieve this with titlesec page. Here's what I got so far.

\documentclass[twoside]{article}
\usepackage{lipsum}
\usepackage{titlesec}

\titleformat{name=\section,page=even}[leftmargin] {\normalfont\filleft}{}{.5em}{\MakeUppercase}

\titleformat{name=\section,page=odd}[rightmargin] {\normalfont\filleft}{}{.5em}{\MakeUppercase}

\titlespacing{\section} {4pc}{}{1pc} %I'm not quite sure with this one

\usepackage{enumitem}

\newlist{paragraphlist}{enumerate}{1} \setlist[paragraphlist,1]{leftmargin=,label={\arabic}}

\counterwithin{paragraphlisti}{subsubsection}

\begin{document}

\section{Lipsuma \ Amuspil} %doesn't work \begin{paragraphlist} \item \lipsum[1][1] \item \lipsum[1][2] \item \lipsum[1][3] \item \lipsum[1][4] \item \lipsum[1][5] \end{paragraphlist}

\newpage

\section{Lipsumb \ Bmuspil} %doesn't work \begin{paragraphlist} \item \lipsum[2][1] \item \lipsum[2][2] \item \lipsum[2][3] \item \lipsum[2][4] \item \lipsum[2][5] \end{paragraphlist} \end{document}

Andre
  • 148
  • 6

1 Answers1

1

I was too lazy to do this with titlesec, but it is probably possible. Instead, I knitted together a tikz-based approach:

\documentclass[twoside]{article}

\usepackage{tikz} \usetikzlibrary{tikzmark} \usepackage{tikzpagenodes}

\newcommand{\verticalsection}[2]{% \stepcounter{section}% \addcontentsline{toc}{section}{#1 (#2)}% \tikzmarknode{sec-\thesection-mark}{\strut}% \checkoddpage% \ifoddpage% \begin{tikzpicture}[remember picture, overlay] \node[anchor=south west, align=left, rotate=-90] at (sec-\thesection-mark.north -| current page marginpar area.west) {\textcolor{purple}{\MakeLowercase{\scshape#1}}\ \MakeLowercase{\scshape#2}}; \end{tikzpicture}% \else% \begin{tikzpicture}[remember picture, overlay] \node[anchor=south east, align=right, rotate=90] at (sec-\thesection-mark.north -| current page marginpar area.east) {\textcolor{purple}{\MakeLowercase{\scshape#1}}\ \MakeLowercase{\scshape#2}}; \end{tikzpicture}% \fi% }

\usepackage{lipsum}

\begin{document}

\verticalsection{Lipsuma}{Amuspil foo} \lipsum[1]

\verticalsection{Lipsumb}{Bmuspil bar} \lipsum[1]

\newpage

\verticalsection{Lipsumc}{Cmuspil baz} \lipsum[1]

\end{document}

Odd pages (sections may start at any position on the page): enter image description here

Even pages: enter image description here


Another more basic approach using \marginpar:

\documentclass[twoside]{article}

\usepackage{graphicx, xcolor}

\newcommand{\verticalsection}[2]{% \stepcounter{section}% \addcontentsline{toc}{section}{#1 (#2)}% \marginpar[% \raggedleft\vskip5pt\rotatebox{90}{\parbox{10em}{\raggedleft% \textcolor{purple}{\MakeLowercase{\scshape#1}}\par\MakeLowercase{\scshape#2}\hskip5pt}% }% ]{% \rotatebox{270}{\hskip5pt\parbox{10em}{% \textcolor{purple}{\MakeLowercase{\scshape#1}}\par\MakeLowercase{\scshape#2}}% }% }% }

\usepackage{lipsum}

\begin{document}

\verticalsection{Lipsuma}{Amuspil foo} \lipsum[1]

\verticalsection{Lipsumb}{Bmuspil bar} \lipsum[1]

\newpage

\verticalsection{Lipsumc}{Cmuspil baz} \lipsum[1]

\end{document}

With pretty much the same output:

enter image description here

enter image description here

You need to take care of the width of the vertical box though: If it is longer than the paragraph it is attached to, the next section title will be shifted downwards.

Also, if a sections starts too far down the page, it may be better to let it start on the next page, since otherwise the section title will protrude over the lower page margin.

  • Too much time to realize I've been missing out other possibilities I'd get outside titlesec. Thank you very much. – Andre Dec 12 '21 at 03:27
  • Can you explain why the \marginpar approach has result shifted a little high than the first line of paragraph? Surely that can be tweaked, isn't it? – Andre Dec 12 '21 at 03:28
  • Right, I added an correction. Also, you may want to adjust the width of the box for the vertical title in the \marginpar approach. It should be as wide as your longest title, but not longer as the shortest paragraph. – Jasper Habicht Dec 12 '21 at 08:03