Text FormattingAppend text to subsection title

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
mlinfoot
Posts: 1
Joined: Mon Sep 01, 2014 11:25 pm

Append text to subsection title

Post by mlinfoot »

Greetings! I'm new to the Latex community and relatively new to Latex. I've been searching for a way to have a static piece of text automatically appended to subsection titles.

For example, I want something like:

Code: Select all

\documentclass[english,oldfontcommands]{memoir}
\chapterstyle{hangnum}
\renewcommand\thesection{\arabic{section}}
\setsecheadstyle{\LARGE\bfseries}
\renewcommand\thesubsection{\arabic{subsection}}
\setsubsecheadstyle{\Large\bfseries}

\begin{document}
\pagestyle{companion}
...
\newcommand\mytext{Foo}
\subsection{First}
\subsection{Second}
\renewcommand\mytext{Bar}
\subsection{Third}
\subsection{Fourth}
...
To produce something like:

1 First Foo
2 Second Foo
3 Third Bar
4 Fourth Bar


Any help would be much appreciated.

PS. I've read elsewhere that titlesec and memoir do not work well together, so I think I would prefer suggestions/solutions that do not depend on titlesec.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply