If you are using amsmath
, just redefine \tagform@
in this way
\makeatletter
\renewcommand\tagform@[1]{\maketag@@@{\ignorespaces#1\unskip\@@italiccorr}}
\makeatother
MWE
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\renewcommand\tagform@[1]{\maketag@@@{\ignorespaces#1\unskip\@@italiccorr}}
\makeatother
\begin{document}
\begin{equation}
x=y
\end{equation}
\end{document}
EDIT
As egreg notices, you might want \eqref
to keep the parenthesis when printing the reference. In this case, replace the above code with
\makeatletter
\let\oldtagform@\tagform@
\renewcommand\tagform@[1]{\maketag@@@{\ignorespaces#1\unskip\@@italiccorr}}
\renewcommand{\eqref}[1]{\textup{\oldtagform@{\ref{#1}}}}
\makeatother
MWE:
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\let\oldtagform@\tagform@
\renewcommand\tagform@[1]{\maketag@@@{\ignorespaces#1\unskip\@@italiccorr}}
\renewcommand{\eqref}[1]{\textup{\oldtagform@{\ref{#1}}}}
\makeatother
\begin{document}
\begin{equation}\label{myeq}
x=y
\end{equation}
A reference to equation \eqref{myeq}
\end{document}
Output:
Original solution
Here is a solution using enumitem
and enumerate
environments.
Not sure wether it's really what you asked for, since you mentioned a numbering of sections.
However, with this solution, all your regularly numbered items must be in a (first level) enumerate
environment, and when you need bis, ter, etc, then you can use a nested enumerate
environment. Keep in mind that the first \item
of this environment will be numbered bis, the second will be numbered ter, etc
\documentclass{article}
\usepackage{xparse}
\usepackage{enumitem}
\ExplSyntaxOn
\seq_new:N \bislist
\seq_set_split:Nnn \bislist {;} {bis;ter;quater;quinquies;sexies;septies;octies;novies;decies}
\NewDocumentCommand {\bisprint} {m}
{
\seq_item:Nn \bislist {#1}
}
\ExplSyntaxOff
\setlist[enumerate,1]{leftmargin=0pt,labelwidth=!,label=\arabic*.,align=left}
\setlist[enumerate,2]{leftmargin=0pt,labelwidth=!,label=\arabic{enumi} \bisprint{\arabic{enumii}}.,align=left}
\begin{document}
\begin{enumerate}
\item First item
\item Second item
\begin{enumerate}
\item First bis item
\item First ter item
\end{enumerate}
\end{enumerate}
\end{document}
Which produces this kind of results :
Maybe, another option to avoid conflicts with other nested enumerate
environments would be to create a bis
environment this way :
\documentclass{article}
\usepackage{xparse}
\usepackage{enumitem}
\ExplSyntaxOn
\seq_new:N \bislist
\seq_set_split:Nnn \bislist {;} {bis;ter;quater;quinquies;sexies;septies;octies;novies;decies}
\NewDocumentCommand {\bisprint} {m}
{
\seq_item:Nn \bislist {#1}
}
\ExplSyntaxOff
\setlist[enumerate,1]{leftmargin=0pt,labelwidth=!,label=\arabic*.,align=left}
\newlist{bis}{enumerate}{1}
\setlist[bis]{leftmargin=0pt,labelwidth=!,label=\arabic{enumi} \bisprint{\arabic{bisi}}.,align=left}
\begin{document}
\begin{enumerate}
\item First item
\item Second item
\begin{bis}
\item First bis item
\item First ter item
\end{bis}
\end{enumerate}
\end{document}
This produces the exact same result than the previous code.
Note that if you have 10 or more items in the bis
environment, then the numbering will fail (essentially because I have no idea of what follows decies).
But I hope your original text does not need to go that far ;-) (however, it seems that certain french laws use decies, and maybe the few next ones...)
Edit : solution working with \section
Here is a solution using \section
and \section*
.
Caution : by redefining these two commands, you will not be able to use them for anything else in the rest of your document (I think you were aware of this, but just in case, now it's clear).
The idea here is to use \section{}
to begin a regularly numbered section, and \section*{}
for a bis numbered section.
\documentclass{article}
\usepackage{xparse}
\usepackage{enumitem}
\usepackage[explicit]{titlesec}
\usepackage{lipsum}
\ExplSyntaxOn
\seq_new:N \bislist
\seq_set_split:Nnn \bislist {;} {bis;ter;quater;quinquies;sexies;septies;octies;novies;decies}
\NewDocumentCommand {\bisprint} {m}
{
\seq_item:Nn \bislist {#1}
}
\ExplSyntaxOff
\newcounter{bis}
\stepcounter{bis}
\titleformat{\section}[runin]{\normalfont}{\arabic{section}.}{0pt}{}[\setcounter{bis}{1}]
\titleformat{name=\section,numberless}[runin]{\normalfont}{\arabic{section} \bisprint{\arabic{bis}}.}{0pt}{}[\stepcounter{bis}]
\titlespacing{\section}{\parindent}{\baselineskip}{\parindent}{}
\begin{document}
\section{}
\lipsum[1]
\section{}
\lipsum[2]
\section*{}
\lipsum[3]
\section*{}
\lipsum[4]
\section*{}
\lipsum[5]
\section{}
\lipsum[6]
\section{}
\lipsum[7]
\section*{}
\lipsum[8]
\end{document}
If the formatting is not exactly the one you wanted, you can change the parameters of \titleformat
and \titlespacing
(for example, changing \normalfont
to \bfseries
will produce bolded numbers).
Update : with the table of contents
Here is a last update with the \section*
appearing in the table of contents (and this time using book
document class as you wanted and with the title formatting you were using in your MWE).
\documentclass{book}
\usepackage{xparse}
\usepackage{enumitem}
\usepackage[explicit]{titlesec}
\usepackage{lipsum}
\usepackage{calc}
\usepackage{totcount}
\ExplSyntaxOn
\seq_new:N \bislist
\seq_set_split:Nnn \bislist {;} {bis;ter;quater;quinquies;sexies;septies;octies;novies;decies}
\NewDocumentCommand {\bisprint} {m}
{
\seq_item:Nn \bislist {#1}
}
\ExplSyntaxOff
\newtotcounter{bismax}
\newcounter{bis}
\stepcounter{bis}
\setcounter{bismax}{1}
\newcommand{\bisadd}{\stepcounter{bis} \setcounter{bismax}{\minof{4}{\maxof{\thebismax}{\thebis-1}}}}
\AtBeginDocument{\newlength{\bislength}
\settowidth{\bislength}{\textit{\bisprint{\totvalue{bismax}}}}
\addtolength{\bislength}{1.5em}}
\titleformat{\section}[block]{\normalfont\large\normalfont\filcenter}{\thesection. --- #1}{0.5em}{}[\setcounter{bis}{1}]
\renewcommand\thesection{\arabic{section}}
\titleformat{name=\section,numberless}[block]{\normalfont\large\normalfont\filcenter}{\arabic{section} \textit{\bisprint{\arabic{bis}}}. --- #1}{0.5em}{}[ \addcontentsline{toc}{section}{\protect\numberline{\arabic{section} \textit{\bisprint{\arabic{bis}}}}#1} \bisadd{}]
\makeatletter
\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{\bislength}}
\makeatother
\begin{document}
\tableofcontents
\section{First section header}
\lipsum[1]
\section{Second section header}
\lipsum[2]
\section*{Third section header}
\lipsum[3]
\section*{Fourth section header}
\lipsum[4]
\section*{Fifth section header}
\lipsum[5]
\section*{Sixth section header}
\lipsum[6]
\section{Seventh section header}
\lipsum[7]
\section*{Eighth section header}
\lipsum[8]
\end{document}
The space between the numbers and the section titles in ToC is now automatically computed so that it is enough to display the longest "bis number" (i.e. the space will be smaller if you just have to print bis or ter
than if you need to print quiquies).
You can enlarge or reduce this space by changing the value currently set to 1.5em
.
Best Answer
Without expl3, you can convert integers to whatever you want with:
By substituting
#1
by the number you want. In this case, we can create a macro, and pass\value{equation}
as argument.In any case, I don't know what's the way the arabic numbers in front of
bis
and such is incremented. So I create a macro,\latintags
to be used inside of a group, that saves the current equation counter and starts using bis, etc.If (as I imagine) you want this to happen only inside a certain environment, like, e.g.,
corollary
, you can useetoolbox
Or may be not necessarily inside a theorem like environment, but just a few equations, you can use the
{latintags}
environment to group them: