LyXRemove "Chapter" from Chapter Headings

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
EigenGoofy
Posts: 42
Joined: Fri Jul 22, 2011 12:26 am

Remove "Chapter" from Chapter Headings

Post by EigenGoofy »

Hello, all!

I am writing a lab report, so I select "Report" in the document class provided by LyX. The problem is that I want to remove the name "Chapter" on each chapter.

For example, on the attachment below, the form I want is "1. Introduction", rather than "Chapter 1 Introduction". How can erase "Chapter" please?

On thing I want to emphasize is that I don't want to use environment Chapter*, because it is unnumbered, and is not shown on the table of content, maybe not on the head of each page as well.

Thank you!
Attachments
chapter.png
chapter.png (23.1 KiB) Viewed 19523 times

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

EigenGoofy
Posts: 42
Joined: Fri Jul 22, 2011 12:26 am

Remove "Chapter" from Chapter Headings

Post by EigenGoofy »

Now I have successfully changed my chapter name and also the chapter number in roman by using

Code: Select all

\renewcommand{\chaptername}{}
\renewcommand{\thechapter}{\Roman{chapter}} 
Note these two command should NOT put in the preamble in LyX, otherwise, it does not work properly. It must be put below the table of content in ERT, for example.

Now I have another problem. How can I move the chapter number "I" and name "Introduction" on the same line, instead of two lines, please?
Attachments
chapter.png
chapter.png (9.39 KiB) Viewed 19520 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10330
Joined: Mon Mar 10, 2008 9:44 pm

Remove "Chapter" from Chapter Headings

Post by Stefan Kottwitz »

EigenGoofy wrote:

Code: Select all

\renewcommand{\chaptername}{}
This line makes the chapter name empty, but the layout of the chapter heading is still reserved.

You could
  • change the document class from report to scrreprt, i.e. the KOMA-Script report class, which has such chapter headings by default. This would be my choice, since KOMA-Script classes offer much more features.
  • You could use the titlesec package for customizing the headings. The titlesec manual contains example heading settings of the standard classes in the appendix, this is a nice start for understanding and redefining.
  • You could redefine internal report class macros.
EigenGoofy wrote: Note these two command should NOT put in the preamble in LyX, otherwise, it does not work properly. It must be put below the table of content in ERT, for example.
That's because you are using the babel package, which defines such names depending on the document language. You could use a babel command for this, in the preamble, such as

Code: Select all

\addto{\captionsenglish}{\renewcommand{\chaptername}{Newname}}

Stefan
LaTeX.org admin
EigenGoofy
Posts: 42
Joined: Fri Jul 22, 2011 12:26 am

Re: Remove "Chapter" from Chapter Headings

Post by EigenGoofy »

I am sorry that I recently really didn't have time to look at your message, Stefan_K!

The KOMA-Script report class does not help that much, since it changes somewhere else which I don't like.

I'll try to use titlesec package.

Thank you very much, Stefan_K! Your book is wonderful - despite of the fact that I want you put more detailed instruction and more examples on those advanced chapter, such as chapter 7, 9, 10, etc.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10330
Joined: Mon Mar 10, 2008 9:44 pm

Re: Remove "Chapter" from Chapter Headings

Post by Stefan Kottwitz »

Very nice to read that you like the book!

Yes, the KOMA-Script classes have some different defaults, but they can easily be changed. In the long run, one can benefit from the many more features those classes offer.

Stefan
LaTeX.org admin
Post Reply