Can I give predefined values to section numbers?
Use a couple of \setcounter
intructions, operating on the counter variable called section
.
\documentclass[11pt]{article}
\begin{document}
\setcounter{section}{2} % so that the next section is numbered "3"
\section{Third}
\setcounter{section}{4} % so that the next section is numbered "5"
\section{Fifth}
\section{Sixth} % no need to set the 'section' counter variable for this section
\end{document}
Expand this to your needs adding more \or<number>
bits as needed.
\documentclass{article}
\makeatletter
\newcommand{\fancynumbering}[1]{\expandafter\@fancynumbering\csname c@#1\endcsname}
\newcommand{\@fancynumbering}[1]{%
\ifcase#1\or3\or5\or6\else\@ctrerr\fi
}
\makeatother
\renewcommand{\thesection}{\fancynumbering{section}}
\begin{document}
\section{Third}
\section{Fifth}
\section{Sixth}
\end{document}
A possibly cleaner interface:
\documentclass{article}
\usepackage{xparse}
\ExplSyntaxOn
\NewDocumentCommand{\setupfancycounter}{mm}
{
\clist_const:cn { c_typos_#1_clist } { #2 }
}
\DeclareExpandableDocumentCommand{\fancynumbering}{mm}
{
\int_compare:nTF
{ \int_use:c { c@#2 } > \clist_count:c { c_typos_#1_clist } }
{ \use:c { @ctrerr } }
{ \clist_item:cn { c_typos_#1_clist } { \int_use:c { c@#2 } } }
}
\ExplSyntaxOff
\setupfancycounter{fancynumbers}{3,5,6}
\renewcommand{\thesection}{\fancynumbering{fancynumbers}{section}}
\begin{document}
\section{Third}
\section{Fifth}
\section{Sixth}
\section{Oops}
\end{document}
The last section will raise an error.
There's an easier method, but the above ones have the advantage of using the standard markup.
\documentclass{article}
\newcommand{\fixedsection}[1]{%
\setcounter{section}{#1}%
\addtocounter{section}{-1}%
\section
}
\begin{document}
\fixedsection{3}{Second}
\fixedsection{5}{Third}
\fixedsection{6}{Sixth}
\end{document}