My current section numbering format is something like this:
1
1.2
1.2,3
But I want it to be like this:
1-
1-2-
1-2-3-
What should I do?
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityMy current section numbering format is something like this:
1
1.2
1.2,3
But I want it to be like this:
1-
1-2-
1-2-3-
What should I do?
Redefine \thesection
, \thesubsection
and \thesubsubsection
(the representation for the counters):
\documentclass{article}
\renewcommand\thesection{\arabic{section}--}
\renewcommand\thesubsection{\thesection\arabic{subsection}--}
\renewcommand\thesubsubsection{\thesubsection\arabic{subsubsection}--}
\begin{document}
\section{Test section}
\subsection{Test subsection}
\subsubsection{Test subsubsection}
\end{document}
Based on a comment, it seems that the bidi
package is being used; in this case, the change can be made using simply \SepMark
, as in the following example:
\documentclass{book}
\usepackage{bidi}
% Use either the next line or the \renewcommand lines below
\SepMark{--}
%\renewcommand\thesection{\arabic{section}--}
%\renewcommand\thesubsection{\thesection\arabic{subsection}--}
\begin{document}
\chapter{Test chapter}
\section{Test section}
\subsection{Test section}
\end{document}
\renewcommand\section{\arabic{section}--}
but \renewcommand\thesection{\arabic{section}--}
(notice the prefix "the" that you omitted in your code) and analogously fot the other commands.
– Gonzalo Medina
Jul 4 '14 at 14:58
xelatex
and the bidi
package (you should have mentioned this in your question). In that case, the redefinitions I suggested must be added after loading the package, or you can use \SepMark
as you mentioned in your comment. I added a remark about this to my answer.
– Gonzalo Medina
Jul 5 '14 at 1:21
\renewcommand\section{\arabic{section}--} \renewcommand\subsection{\section\arabic{subsection}--} \renewcommand\subsubsection{\subsection\arabic{subsubsection}--}
but\renewcommand\thesection{\arabic{section}--} \renewcommand\thesubsection{\section\arabic{subsection}--} \renewcommand\thesubsubsection{\subsection\arabic{subsubsection}--}
. – Gonzalo Medina Jul 4 '14 at 15:11