0

I want to cross-reference custom items in my document the same way I would do for figures, tables etc... For example I would like to add something like \label{custom_item: label} and then use something like \ref{custom_item: label} to produce "Item 1", "Item 2" etc.. How can I do it? Obviously the label "Item" would be written every time and not produced by LaTeX, the same way you have to write "Figure" when referencing figures.

0

1 Answer 1

2

You only need a counter that you increase with \refstepcounter:

\documentclass{article}
\newcounter{myitem}
\begin{document}
\refstepcounter{myitem}\label{myitem-a}
\refstepcounter{myitem}\label{myitem-b}

Item~\ref{myitem-a}, Item~\ref{myitem-b}
\end{document}

enter image description here

3
  • Thank you, that works great.
    – Adam
    Commented May 8, 2023 at 12:55
  • @Adam With a bit more work with cleverref or hyperref, you can also get the Item~ part to appear.
    – Teepeemm
    Commented May 8, 2023 at 13:47
  • @Teepeemm Thank you.
    – Adam
    Commented May 8, 2023 at 14:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .