Text FormattingAppendix formating, problem with number and period

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Appendix formating, problem with number and period

Post by Stefan Kottwitz »

The main problem is, that you did not work with LaTeX features to create the appendix. Regarding the code in your first post:

Code: Select all

\begin{flushright}
1.appendix
\end{flushright}
How should LaTeX know the number of a section in the document structure, if just a 1. has been printed? That doesn't work. Instead of looking for more workarounds, I recommend to either
  • work with LaTeX standard sectioning features
  • or use packages such as the mentioned titlesec package, titletoc or tocloft to customize headings and table of contents entries.
The first point is quick and easy. If you wish to do it differently compared to pretty common and widely used styles, it requires reading of those package manuals. Thanks to their programmers, features for fine customizing are available.

Stefan
LaTeX.org admin

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

Kaspars
Posts: 37
Joined: Mon Feb 14, 2011 11:51 am

Appendix formating, problem with number and period

Post by Kaspars »

Oki, I changed my code, and now, it looks like this:

Code: Select all

\renewcommand{\appendixname}{\arabic{section}.\arabic{equation}} 
\appendix
\renewcommand{\thesection}{\arabic{section}} 
\titlecontents{section}
   [3.5em]% 
   {\vspace{0.5em}}%
   {\contentslabel{1.5em}}%
   {\hspace*{-1.5em}}%
   {\titlerule*[1pc]{.}\contentspage}
   []
\titleformat{\section}
   {\normalsize\filleft}
   {\thesection.}
   {0em}
   {}
   []
\section[Appendix. DM Matlab code]{Appendix}
\label{a:DM}
\begin{center}
{\Large{\bf{DM Matlab code}}}
\end{center}
Everything is just fine, my appendix looks like my University wants it, in text appendix numbers works great with \ref{a:DM}, but still there is one small problem:
In TOC there is no period after number, so it looks like this:
1 Appendix. DM Matlab code

But I want:
1. Appendix. DM Matlab code

Any ideas?

Thanks for help :)
Post Reply