LyXAlpha-numerical chapters

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
aerus
Posts: 4
Joined: Sat Feb 04, 2012 11:33 am

Alpha-numerical chapters

Post by aerus »

Hello,

I try to use LyX to write my german law thesis. If I add chapters and sections, I get a structure like I, 1, 1.1 what I want is though: A, I, 1, a), aa, (i), (ii)

Is it possible with LyX? If yes, how?

Thank you in advance

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10328
Joined: Mon Mar 10, 2008 9:44 pm

Alpha-numerical chapters

Post by Stefan Kottwitz »

Hi Aerus,

welcome to the board!

You could place LaTeX redefinitions in your LyX document preamble for that.

Code: Select all

\renewcommand*{\thechapter}{\Alph{chapter}}
...
\renewcommand*{\thesubsubsection}{(\roman{subsubsection})}


Have a look at Manipulating the way counters are printed to learn more about that.

Stefan
LaTeX.org admin
aerus
Posts: 4
Joined: Sat Feb 04, 2012 11:33 am

Re: Alpha-numerical chapters

Post by aerus »

Thanks for your rapid reply.

If I set this into preamble, I get this error message:

LaTex Error: \thechapter undefined

What can it be?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10328
Joined: Mon Mar 10, 2008 9:44 pm

Re: Alpha-numerical chapters

Post by Stefan Kottwitz »

Obviously you use a document class which doesn't provide chapters, such as article. Or which one did you choose?

Stefan
LaTeX.org admin
aerus
Posts: 4
Joined: Sat Feb 04, 2012 11:33 am

Re: Alpha-numerical chapters

Post by aerus »

Ok, thanks, I figured it out now. I have another question. My TOC looks now like in the attachment.

I don't need the spacing between the number and the caption. How can I change this, too?
Attachments
alphanum-chapters.png
alphanum-chapters.png (115.27 KiB) Viewed 13002 times
Last edited by Stefan Kottwitz on Sat Feb 04, 2012 1:04 pm, edited 1 time in total.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10328
Joined: Mon Mar 10, 2008 9:44 pm

Re: Alpha-numerical chapters

Post by Stefan Kottwitz »

Perhaps post your settings here, or the LyX preamble, as attachment. We cannot see yet how you produce that space or which settings cause that.

Stefan
LaTeX.org admin
aerus
Posts: 4
Joined: Sat Feb 04, 2012 11:33 am

Alpha-numerical chapters

Post by aerus »

I use article with KOMA-Script. My preamble looks like this:

Code: Select all

\renewcommand*{\thepart}{\Alph{part}}
\renewcommand*{\thesection}{\Roman{section}}
\renewcommand*{\thesubsection}{\arabic{subsection}}
\renewcommand*{\thesubsubsection}{\alph{subsubsection}}
\renewcommand*{\theparagraph}{\roman{paragraph}}
\renewcommand*{\thesubparagraph}{(\arabic{subparagraph})}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10328
Joined: Mon Mar 10, 2008 9:44 pm

Alpha-numerical chapters

Post by Stefan Kottwitz »

Ok, let's make a minimal working example, with your settings and class:

Code: Select all

\documentclass{scrartcl}
\renewcommand*{\thepart}{\Alph{part}}
\renewcommand*{\thesection}{\Roman{section}}
\renewcommand*{\thesubsection}{\arabic{subsection}}
\renewcommand*{\thesubsubsection}{\alph{subsubsection}}
\renewcommand*{\theparagraph}{\roman{paragraph}}
\renewcommand*{\thesubparagraph}{(\arabic{subparagraph})}
\begin{document}
\tableofcontents
\section{Section level}
\subsection{Subsection level}
\subsubsection{Subsubsection level}
\subsubsection{Subsubsection level}
\paragraph{Paragraph level}
\end{document}
You will get the default look, which reserves space for wider numbers, because numbering such as I.1.a. is expected.
default-look.png
default-look.png (8.07 KiB) Viewed 12998 times
Now let's load tocstyle. It belongs to KOMA-Script, which you have installed, and provides an option for automatically calculating the indentation in the toc.

Code: Select all

\usepackage[tocindentauto]{tocstyle}
It will calculate during several LaTeX compiler runs, then it will finally look this way:
tocstyle-look.png
tocstyle-look.png (8.06 KiB) Viewed 12998 times
Stefan
LaTeX.org admin
Post Reply