0

So suppose I have some simple enumerated list.

\begin{enumerate}
\item arbitrary text
\item arbitrary text
...
\end{enumerate}

Is there an elegant way to mark the enumerated number for each item, to make it easier to find if I want to edit? (before the .tex file is compiled)

The obvious way is the manual way (comment tagging) and searching for the comment pattern in my editor via CTRL+F or similar.

\begin{enumerate}
\item arbitrary text % [Solution 1]
\item arbitrary text % [Solution 2]
...
\end{enumerate}

But that requires me to keep track of each item myself, and if I do a \setcounter{enumi}{(number that isn't sequential to the last list item number)}, I need to manually keep track in my head what the current number for that particular enumeration is to tag it with a search tag that I can then CTRL+F to in my editor.

Example for clarity

\begin{enumerate}
\item arbitrary text % [Solution 1]
\end{enumerate}

\begin{enumerate}
\setcounter{enumi}{50}
\item arbitrary text % [Solution 51] ... clunky
\end{enumerate}

Suppose the text under each item is quite long, if I make a miscount anywhere while tagging the items manually, I need to recount starting from the last place, not ideal. I'm looking for a command or some "preprocessor"? that can handle this enumeration item tagging in the .tex file itself.

  • welcome to tex.sx, is there a reason why you wouldn't want to use a \labe;{...} with a name you can remember? – barbara beeton Mar 2 '18 at 19:15
  • I think this question is about text editing. For example, vim has this ability using its mark syntax – cmhughes Mar 2 '18 at 19:17
  • @barbarabeeton mainly QoL, I've been doing something of that sort for a while now, and it works, but it's another thing to keep track of when proofreading my tex files. I'm also by no means a master of tex. – rpg711 Mar 2 '18 at 19:19
  • @rpg711 surely having hard coded numbers in the source file (even added by a pre-processor) should be a non-aim. You really haven't given any reason why you would ever want this (that doesn't imply that you have to justify asking the question, I'm just curious:-) – David Carlisle Mar 2 '18 at 19:23
  • 2
    LaTeX is built around the idea that you should almost never need to know the generated numbers while editing, so that adding or removing text and changing the numbers is not an issue. If you want to mark an item use \label{item-about-zzzz} then you can search for that text in the source, and generate the relevant number in the output. – David Carlisle Mar 2 '18 at 19:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.