3

When doing proofs, I make the semantic distinction of numerating everything that is an assumption as letters and proof obligations in roman numerals. Unfortunately, this clashes for the letter (i) and I'm looking for a way to circumvent this. I can easily prevent this myself by hand via \setcounter{enumi}{8} right in front of the offending item of my list of assumptions. However, this is error prone. Is there any way to automate this and just skip the character?

screenshot of the here described issue

Here is an M(N)WE that produces the clash:

\documentclass[a4paper]{article}
\usepackage{enumitem}

\newenvironment{assumptions} {\begin{enumerate}[label=(\alph)] } { \end{enumerate} } \newenvironment{goals} {\begin{enumerate}[label=(\roman)] } { \end{enumerate} }

\begin{document} If \begin{assumptions} \item $1+1=2$ \item $2+0=2$ \item $0+2=2$ \item $3-1=2$ \item $4-2=2$ \item $5-3=2$ \item $6-4=2$ \item $7-5=2$ \end{assumptions} Then \begin{goals} \item uhoh \item this is ok \end{goals} \end{document}

NaCl
  • 137
  • 1
    Would be easier to answer if you gave us some minimal compilable code that produces what you show us. – Skillmon Dec 14 '22 at 14:59
  • Isn't this quite hard to understand for the reader? Then he'd look for i among the roman numerals, won't find it… wouldn't it be better to make one upright and the other italic, or, even better, just use numbers for one and letters/roman numerals for the other? Or small/capital, latin/greek… many better distinctions. – Bubaya Dec 14 '22 at 14:59
  • 1
    this will be confusing, can you not choose non clashing schemes. a,b,c,I,II,III or 1,2,3,i,ii,iii for example? – David Carlisle Dec 14 '22 at 15:02
  • alright, I sense it's harder to achieve what I (currently) want than just switching gears and using e.g. hebrew and roman numerals. Nevertheless, may be an interesting question from TeX macro magic POV. – NaCl Dec 14 '22 at 15:03
  • 1
    actually just adapt one of the answers in 1 (more related questions: 2 3 4 5 6

    )

    – user202729 Dec 14 '22 at 15:09
  • @Skillmon added a minimal example. – NaCl Dec 14 '22 at 15:09
  • Thanks for your comments. Feel free to close or whatever, I don't know why I haven't thought about simply defining my own sequence... @user202729 – NaCl Dec 14 '22 at 15:11
  • @NaCl don't forget to use \AddEnumerateCounter (as shown in one of the answers to the linked questions). – Skillmon Dec 14 '22 at 15:23

1 Answers1

1

As pointed out by others in the comments, it seems that the best way to prevent this clash is just to change one of the numbering styles. But if you prefer, you can also set the assumptions list to modify the \item command to check the number before printing a new item to automatically skip "(i)".

\documentclass[a4paper]{article}
\usepackage{enumitem}

\let\olditem\item \newcommand{\changeitem}{% \def\item{% \ifnum\arabic{assumptionsi}=8 \stepcounter{assumptionsi}% \olditem% \else \olditem% \fi% }% } \newlist{assumptions}{enumerate}{1} \setlist[assumptions]{ label=(\alph), before=\changeitem, after={\let\item\olditem}, }

\newlist{goals}{enumerate}{1} \setlist[goals]{label=(\roman*)}

\begin{document} If \begin{assumptions} \item $1+1=2$ \item $2+0=2$ \item $0+2=2$ \item $3-1=2$ \item $4-2=2$ \item $5-3=2$ \item $6-4=2$ \item $7-5=2$ \item $8-6=2$ \end{assumptions} Then \begin{goals} \item uhoh \item this is ok \end{goals} \end{document}

By the way, instead of defining your assumptions and goals lists with \newenvironment, you can define them as clones of enumerate with enumitem's \newlist. Then you can use \setlist to set both of them differently.

Vincent
  • 20,157