In some papers and books you see that author uses §1.3 instead of section 1.3. How § sign can be added before section (or part, chapter, …) number automatically? Please mention any useful tip about this style.
see also: Fancy cross-referencing
cross-referencingformattingsymbols
In some papers and books you see that author uses §1.3 instead of section 1.3. How § sign can be added before section (or part, chapter, …) number automatically? Please mention any useful tip about this style.
see also: Fancy cross-referencing
The following solution uses the same method as the table of contents is generated.
The entries for the list of important things are written to the .aux
file, then at the end of the document LaTeX writes it to the file \jobname.imp
. In the next run this file is read and a table is set.
\documentclass{report}
\usepackage{longtable}
\makeatletter
\newlength\ImpLineWidth
\newtoks\ImpToks
\newcommand*{\printimportant}{%
\clearpage
\section*{\centering Index of important things}%
\setlength{\ImpLineWidth}{\linewidth}%
\addtolength{\ImpLineWidth}{-2\tabcolsep}
\begin{longtable}{@{}p{.6\ImpLineWidth}p{.4\ImpLineWidth}@{}}%
\global\ImpToks{}%
\@starttoc{imp}%
\the\ImpToks
\end{longtable}%
}
\newcommand*{\importantentry}[2]{%
\global\ImpToks\expandafter{%
\the\ImpToks
\centering #1&
\centering #2\tabularnewline
}%
\ignorespaces
}
\newcommand*{\important}[1]{%
\addtocontents{imp}{%
\protect\importantentry{#1}{%
\ifnum\value{part}=0 %
\else
part~\thepart, %
\fi
\ifnum\value{chapter}=0 %
\else
chapter~\thechapter, %
\ifnum\value{section}=0 %
\else
section~\thesection, %
\fi
\fi
page~\thepage
}%
}%
}
\makeatother
\begin{document}
\part{First part}
\important{Some indexed \dots}
\chapter{First chapter}
\important{Again}
\section{First section}
\important{Idem 1}
\chapter{Second chapter}
\important{Idem 2}
\printimportant
\end{document}
The following uses the index machinery. For the case that there is already an index I have used package index
to get a second one. (There are other packages like multind
, …)
The sectioning titles are usually not available. Exception is the latest title that packages like titleref
, nameref
or zref-titleref
remember. For the best control of the numbering and title, the sectioning commands needs to be patched. Here I have used a shortcut via \addcontentsline
assuming that only sectioning titles are relevant that also goes into the table of contents. A glitch remains, the large space between the part number and the part title, the standardclass uses the hardcoded \hspace{1em}
here.
But anyway, you are using a different unknown setup as the word numbering shows.
For simplicity it is also assumed that the part title is always present.
The first LaTeX run of test.tex
generates test.imx
. The final index file test.imp
is generated via:
makeindex -o test.imp test.imx
Also a different style file than the standard settings can be used to control the output of the final index file.
\documentclass{report}
\usepackage{index}
\newindex{imp}{imx}{imp}{Index of important things}
\makeatletter
\newlength\ImpLineWidth
\newtoks\ImpToks
\newcommand*{\printimportant}{%
\begingroup
\def\numberline##1{##1:~}%
\renewcommand*{\theindex}{%
\clearpage
\section*{\centering Index of important things}%
\setlength{\parskip}{1ex plus .5ex minus .25ex}%
\setlength{\parindent}{0pt}%
\let\item\@idxitem
}{%
\clearpage
}%
\printindex[imp]%
\endgroup
}
% Remember sectioning titles
\newcommand*{\imp@toc}{toc}
\@ifdefinable{\imp@org@addcontentsline}{%
\let\imp@org@addcontentsline\addcontentsline
\renewcommand*{\addcontentsline}[3]{%
\edef\imp@temp{#1}%
\ifx\imp@temp\imp@toc
\begingroup
\expandafter\protected@xdef\csname imp@current@#2\endcsname{#3}%
\csname imp@cleanup@#2\endcsname
\endgroup
\fi
\imp@org@addcontentsline{#1}{#2}{#3}%
}%
}
% Clear subordinate sectioning titles
\def\imp@temp#1#2{%
\expandafter\newcommand\csname imp@cleanup@#1\endcsname{%
\global\expandafter\let\csname imp@current@#2\endcsname\@empty
\csname imp@cleanup@#2\endcsname
}%
}
\imp@temp{part}{chapter}
\imp@temp{chapter}{section}
\imp@temp{section}{subsection}
\newcommand*{\important}[2][]{%
\def\imp@temp{#1}%
\protected@edef\imp@temp{%
\noexpand\index[imp]{%
\ifx\imp@temp\@empty
\else
#1@%
\fi
#2; %
% assuming the part is always present.
part~\csname imp@current@part\endcsname
\ifx\imp@current@chapter\@empty
\else
, chapter~\csname imp@current@chapter\endcsname
% section, ...
\fi
|textbf%
}%
}%
\imp@temp
}
\makeatother
\begin{document}
\tableofcontents
\part{First part}
\important{Some indexed \dots}
\chapter{First chapter}
\important{Again}
\section{First section}
\important{Idem 1}
\chapter{Second chapter}
\important{Idem 2}
\printimportant
\end{document}
You need to Insert>Label within your theorem or corollary. Let's say the label is cor:myprecious
. It might be that autorefname hasn't been defined for these environments, so you'll have to add
\providecommand{\thmautorefname}{Theorem}
\providecommand{\corautorefname}{Corollary}
\providecommand{\lemautorefname}{Lemma}
either to classicthesis-config.tex (say, around line 230) or your Document>Settings>Preamble
You will then insert an autoreference either in a TeX box (ctrl-L) \autoref{cor:myprecious}
or by using a custom inset as described in the manual (screenshot above)
Best Answer
You could use the
cleveref
package and redefine\crefname{section}
: