Number of equation with condition

Darío darioslc at protonmail.com
Sun Mar 28 00:44:56 CET 2021


Hello! I am working in a article documentclass. It have five section using the command \section. My intention is that each equation number showed a determined format depending on if the section number is odd or even.

I intended using the conditionals, before the \section, for example:
\ifodd \value{section} \renewcommand{\theequation}{\textbf{{\thesection}-\alph{equation}}} \else \renewcommand{\theequation}{\textit{{\thesection}-\arabic{equation}}}\fi

But do not work fine, the compilation does not give errors, but all the numbers of equations are in the same format.

This is my first approach with the conditionals, I am testing this.

May do not work because I charging others archives? like this:

\documentclass[10pt,a4paper]{article}
\input{files_whit_packages_and_commands.tex}

\makeindex[columns = 3, intoc, options= -s file.ist]
% begin the document

\begin{document}
\title{title}
\date{2020}
\author{}
\pagebreak

\maketitle
\tableofcontents
\pagebreak

% CONDITIONAL PROOF
\ifodd \value{section} \renewcommand{\theequation}{\textbf{{\thesection}-\alph{equation}}} \else \renewcommand{\theequation}{\textit{{\thesection}-\arabic{equation}}}\fi

\input{file1.tex}
\pagebreak
\input{file2.tex}
\pagebreak
\input{file3.tex}
\pagebreak
\input{file4.tex}
\pagebreak
\input{file5.tex}
\pagebreak

\listoffigures
\addcontentsline{toc}{section}{Índice de figuras}
\listoftables
\addcontentsline{toc}{section}{Índice de tablas}

\pagebreak
\printindex

\end{document}

same result if the conditional in the preambule.

Thanks a lot!
Darío
-

Sent with [ProtonMail](https://protonmail.com) Secure Email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/texhax/attachments/20210327/ee9049ca/attachment.html>


More information about the texhax mailing list.