Text FormattingTOC, appendix and picture formating

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
User avatar
Kaspars
Posts: 37
Joined: Mon Feb 14, 2011 11:51 am

TOC, appendix and picture formating

Post by Kaspars »

Hello,

Here is my code:

Code: Select all

\documentclass[12pt,a4paper,fleqn]{article}

\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage{polyglossia}
\usepackage{appendix}
\setotherlanguages{english}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{titlesec,titletoc}

%%% Changing sectioning units in main text

\titleformat{\section}
   {\Large\bfseries\filcenter}% Title and number text formatting
   {\thesection}% Number formatting
   {1em}% Spacing between the number and the title
   {}% Command/text between the number and the title
   []% Command/text after the title
   
\titleformat{\subsection}
   {\large\bfseries\filcenter}% Title and number text formatting
   {\thesubsection}% Number formatting
   {1em}% Spacing between the number and the title
   {}% Command/text between the number and the title
   []% Command/text after the title

%%% Changing sectioning units in TOC

\titlecontents{section}
   [1.5em]% Left margin
   {\bfseries\vspace{1em}}% Text and number formatting
   {\contentslabel{1.5em}}% Number formatting
   {\hspace*{-1.5em}}% Formatting when there’s no number
   {\titlerule*[1pc]{.}\contentspage}% Filler and page number
   []% Command/text after the title

\titlecontents{subsection}
   [2.3em]% Left margin
   {}% Text and number formatting
   {\hspace{1.5em}\contentslabel{2.3em}}% Number formatting
   {\hspace*{-2.3em}}% Formatting when there’s no number
   {\titlerule*[1pc]{.}\contentspage}% Filler and page number
   []% Command/text after the title

\begin{document}

\clearpage% or \cleardoublepage if you want TOC to be on the right page

%%% TOC

\tableofcontents

%%% Main text

\begin{abstract}

Abstract\ldots

\end{abstract}

\section{first section}

\begin{figure}[!h]
\includegraphics[width=1.00\textwidth]{pic_name}\hfill
\caption{picture descriprion}
\end{figure}

\section{second section}

TEXT

\subsection{Subsection}

TEXT

\section*{\large{APPENDIX}}
\addcontentsline{toc}{section}{APPENDIX}
\appendix
\renewcommand{\thesection}{\arabic{section}.} %Noradu, ka tiks lietota numeracija 1,2,3 nevis A,B,C kaa tas ir defaltaa
\begin{flushright}
1.appendix
\end{flushright}
\section[Appendix. ASDM using trigger]{ASDM using trigger}
\label{a:ASDM}

\end{document}
Picture you can download from attachment.

My problem.
1.question. Like you can see in my file, in TOC there is:
1 first section............1
2 second section...........1
2.1 Subsection............1

But I want dots after section and subsection numbers, so it looks like this:
1. first section............1
2. second section...........1
__2.1. Subsection...........1
Also these dots appier in text.

2.question. You can see in my latex document, that there are appendix. Every thing is ok, except one thing, you can see, that there is something like this:
APPENDIX..........................1
1.Appendix. ASDM using trigger....2

But I want that the 1.appendix is in the same level like subsection, and it would look like this:
1. first section............1
2. second section...........1
__2.1. Subsection...........1
APPENDIX..........................1
__1.Appendix. ASDM using trigger...2

Also, in text I don't want this 1.Appendix. I want just name of it, for example:
___________________________1.Appendix
________ASDM using trigger

3.question. Like you can see, the picture name is represented like this:
Figure 1: picture description

But I want to make this:

1. Figure. picture description

Thanks for your help. :)
Last edited by Kaspars on Wed Mar 09, 2011 9:18 am, edited 1 time in total.

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

west.logan
Posts: 87
Joined: Tue Sep 14, 2010 6:58 pm

TOC, appendix and picture formating

Post by west.logan »

I don't understand your first question. Both your "before and after" look the same to me except for the indentation of 2.1.

I'm not sure I know what you want with question 2 as well.

With 3, you can simply use

Code: Select all

\renewcommand{\figurename}{}
, which basically makes the figure name empty, so you should just see "1. Your title". However, it looks like you wanted to reverse the order of "Figure" and its number, is that correct? That's not good in English but maybe that's really what is required?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

TOC, appendix and picture formating

Post by localghost »

Please don't mix several topics in one thread (see Section 1.4 of the Board Rules). At least your last question is not related to »Text Formatting«. Furthermore please check your example for minimal content (every time). There is a lot of stuff that is not related to your problem.
Kaspars wrote:[…] the picture name is represented like this:
Figure 1: picture description

But I want to make this:

1. Figure. picture description

Thanks for your help. […]
Include the caption package and create a new caption format as demonstrated in the package manual.


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

TOC, appendix and picture formating

Post by Kaspars »

I will repeat my question, but this time I marked with RED colour what I want to get :)

1.question. Like you can see in my file, in TOC there is:
1 first section............1
2 second section...........1
2.1 Subsection............1

But I want dots after section and subsection numbers, so it looks like this:
1. first section............1
2. second section...........1
__2.1. Subsection...........1
Also these dots appier in text.

2.question. You can see in my latex document, that there are appendix. Every thing is ok, except one thing, you can see, that there is something like this:
APPENDIX..........................1
1.Appendix. ASDM using trigger....2

But I want that the 1.appendix is in the same level like subsection, and it would look like this:
1. first section............1
2. second section...........1
__2.1. Subsection...........1
APPENDIX..........................1
__1.Appendix. ASDM using trigger...2

If I put Appendix like subsection I get:

1.1.Appendix :( But I want just to move aside so it would me in the same level like other subsections.

Also, in text I don't want this 1.Appendix. I want just name of it, for example:
___________________________1.Appendix
________ASDM using trigger

with ______ is marked free space.

3. Picture comand don't work :(
User avatar
Kaspars
Posts: 37
Joined: Mon Feb 14, 2011 11:51 am

Re: TOC, appendix and picture formating

Post by Kaspars »

Can anyone help me? :)
west.logan
Posts: 87
Joined: Tue Sep 14, 2010 6:58 pm

Re: TOC, appendix and picture formating

Post by west.logan »

It just seems like quite a bit of formatting work to be done here. Maybe asking for everything all at once isn't the best idea. Most people have other things to work on too. Like Thorsten said, you've got some mixed topics here, and your MWE has a lot of packages that I can't run because I'm not on XeTeX.
User avatar
Kaspars
Posts: 37
Joined: Mon Feb 14, 2011 11:51 am

Re: TOC, appendix and picture formating

Post by Kaspars »

No one in this forum don't know how to solve this problem? Really?
I need only dot (piont) after numeber ir TOC. Is it so hard to do that? :shock:
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

TOC, appendix and picture formating

Post by localghost »

Kaspars wrote:[…] I need only dot (piont) after numeber ir TOC. […]
You are already using titletoc to format the ToC entries. And you even have comments in your code which describe the function quite detailed. So you have just to add the period at the appropriate place … et voilà.
User avatar
Kaspars
Posts: 37
Joined: Mon Feb 14, 2011 11:51 am

TOC, appendix and picture formating

Post by Kaspars »

Oki, I found how to put dot after section, subsection ect by adding dot after section definition:

Code: Select all

\titleformat{\section}
   {\large\bfseries\filcenter}
   {\thesection.} % <- here I add dot
   {1em}
   {}
   []
But I still can't add this dot in TOC. When I put it in different places I get:

1___.Section name......1

This is wrong, I want that dot(point, period) was after numbet like this:
1.___Section name......1

Please help me with that :)
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

TOC, appendix and picture formating

Post by localghost »

For your headings you succeeded by using titlesec. For the dots in the ToC use titletoc as already mentioned. The formatting code is already in your document. Just go one step further and supplement it accordingly. Reading the corresponding package manual won't do any harm.
Post Reply