LyXAltered Heading Numbers

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
tompv
Posts: 7
Joined: Thu Feb 27, 2014 1:12 pm

Altered Heading Numbers

Post by tompv »

Hi,

I am working on an article in LyX (version 2.0.6). Sections are automatically numbered in Arabic numerals and sub-sections accordingly.

I would need to change this: Sections should be numbered in Roman numerals. Sub-sections should be numbered alphabetically (e.g. what are automatically numbered as section 2 and subsection 2.1. should rather become section II and subsection A).

Should it be possible to fix this by means of the menu-bars, that would be even easier as I'm not too comfortable with the actual coding options.

Thanks in advance for you advice!

Tom

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

mas
Posts: 226
Joined: Thu Dec 04, 2008 4:39 am

Altered Heading Numbers

Post by mas »

tompv wrote: Should it be possible to fix this by means of the menu-bars, that would be even easier as I'm not too comfortable with the actual coding options.
I do not use Lyx and have no idea how to implement what you want by means of menu bars. But it is very simple to get what you want by just entering a couple of lines into the preamble of your document. Here is a Infominimal working example for what you want.

Code: Select all

\documentclass{article}

\renewcommand{\thesection}{\Roman{section}}
\renewcommand{\thesubsection}{\thesection.\Alph{section}}

\begin{document}

\section{Intro}

\subsection{Blah}

\section{Intro2}

\subsection{Blah blah}

\end{document}

Attachments
x.jpg
x.jpg (10.29 KiB) Viewed 8092 times

OS: Debian/GNU Linux; LaTeX System : TeXLive; Editor : Vim
tompv
Posts: 7
Joined: Thu Feb 27, 2014 1:12 pm

Re: Altered Heading Numbers

Post by tompv »

Thanks very much.

I'm sure I must be doing something wrong, but nothing changes when I enter this into the LaTeX preamble in LyX (also not in case I open a new document)...
scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

Altered Heading Numbers

Post by scottkosty »

tompv wrote:Thanks very much.

I'm sure I must be doing something wrong, but nothing changes when I enter this into the LaTeX preamble in LyX (also not in case I open a new document)...
Whenever you enter anything in the preamble you cannot count on LyX understanding it. So always check in the compiled PDF. If you want LyX to understand it you need to read about layouts and modules. See Help > Customization.
tompv
Posts: 7
Joined: Thu Feb 27, 2014 1:12 pm

Re: Altered Heading Numbers

Post by tompv »

Thanks
tompv
Posts: 7
Joined: Thu Feb 27, 2014 1:12 pm

Re: Altered Heading Numbers

Post by tompv »

So, in putting the two together, I have added the code provided by mas in the local layout (rather than directly in the LaTeX preamble), as suggested by scottkosty. When adding the "Preamble" and "EndPreamble" commands at the beginning and end, respectively, the "valid layout!" message appears. Yet, nothing actually changes (in a given document) or appears (in a blank document). Thanks for your patience --- I think we're getting close :)
mas
Posts: 226
Joined: Thu Dec 04, 2008 4:39 am

Re: Altered Heading Numbers

Post by mas »

At this point, I feel it is more a LyX question than a LaTeX question :-) Hopefully LyXers around here might help you.

OS: Debian/GNU Linux; LaTeX System : TeXLive; Editor : Vim
tompv
Posts: 7
Joined: Thu Feb 27, 2014 1:12 pm

Re: Altered Heading Numbers

Post by tompv »

Hi,

On the TeX forum, they gave me the following solution, which works:
"To get the result you ask for, add

\renewcommand\thesection{\Roman{section}}
\renewcommand\thesubsection{\Alph{subsection}}

to the preamble."

Thanks and best.
Post Reply