1

I'm returning to LaTeX after many years away from it, and hope you can answer this question.

I am writing a catalogue that has a lot of cross references that need to be individually numbered (probably 5000+), so using the \label and \ref commands will be very useful. I've also used sections and subsections to make the catalogue manageable.

I would simply like to label items starting at number 1, 2, 3 etc. and going to 5000+. I've used \label{itema}\textbf{\ref{itema}} to label and reference the items but this adds in 0.1.1 as its in a subsection, and then restarts the numbering in the next section/subsection.

Any suggestions for how I just get \label to label items as 1, 2, 3 etc. without restarting for each section, subsection etc.

Troy
  • 13,741
  • 1
    Welcome to TeX.SE! Perhaps this would help: http://tex.stackexchange.com/questions/28333/continuous-v-per-chapter-section-numbering-of-figures-tables-and-other-docume – Troy Feb 20 '17 at 00:37
  • 2
    Can you provide a minimal example? The code you've shown will give 0.1.1 or whatever for every item in the subsection as you don't increment any counter, but just use the subsection's, I think. – cfr Feb 20 '17 at 00:39

2 Answers2

3

An example in your question would make it a lot easier to help. And more likely the answer would be of some use to you.

Something like this?

\documentclass{article}
\usepackage{enumitem}
\newlist{myitems}{enumerate}{1}
\setlist[myitems]{label=\arabic*, font=\bfseries, resume}
\begin{document}
\section{Living}
\subsection{Animals}
\begin{myitems}
  \item\label{enum:wombat} Wombat\footnote{Not usually found in terraced houses (\ref{enum:terrace}).}
  \item\label{enum:parrot} Parrot
\end{myitems}
\subsection{Plants}
\begin{myitems}
  \item\label{enum:cactus} Cactus\footnote{Not suitable for igloo-dwellers (\ref{enum:igloo}).}
  \item\label{enum:willow} Willow
  \item\label{enum:ivy} Ivy
\end{myitems}
\subsection*{Important notes}
\begin{enumerate}
  \item Note 1
  \item Note 2
\end{enumerate}
\section{Homes}
\begin{myitems}
  \item\label{enum:igloo} Igloo
  \item\label{enum:terrace} Terraced house
  \item\label{enum:tree} Tree house
\end{myitems}
\end{document}

lists

cfr
  • 198,882
  • Thanks for the suggestion and the way it numbers is how I want it too, but the problem is it creates a list. I'll give an example of what I want to achieve. – C. de Haer Feb 20 '17 at 09:18
  • Okay to clarify what I am trying to do. I want continuous numbering as suggested in the previous answer, however the original \labels need to be in a table (as they are essentially captions, but I want to avoid using the caption command as sometimes there will not be an image).

    I then want to reference these labels in the text. The text may be in another table or just general text (which is in a table or tabbed).

    So here's what I want to achieve:

    456 Koala 457 Kangaroo etc. (these are the original labels)

    Then in the text, No. 456 and 457 were released individually and in...

    – C. de Haer Feb 20 '17 at 09:20
  • Probably I don't really understand what you want then. But I see you've found a solution, so that's good :-). – cfr Feb 20 '17 at 23:19
  • I like Wombats. +1 :-) – Johannes_B Apr 02 '17 at 12:00
2

I've achieve it in this way:

In the header I've added:

\newcounter{koala}
\newenvironment{koala}[1][]{\refstepcounter{koala}\\
   \textbf{\thekoala #1} }

Then in the body:

\includegraphics{koala1.jpg}
\begin{koala}
\label{koala1}Koala in a Tree
\end{koala}

I can then reference the item however I want to.

I may not be the elegant solution to my problem, but it does the job.

If anybody can suggest another solution, please do.

CarLaTeX
  • 62,716
  • 1
    Why the group? That seems very odd. – cfr Feb 20 '17 at 23:19
  • 1
    Why not e.g. \newcommand*\koala[1][]{\refstepcounter{koala}\textbf{\thekoala #1} }? Then \koala ... \koala[Koala] or whatever. You certainly shouldn't have the \\ there. Aside from anything else, \\ should not be used to end lines outside tabular and array etc. So if these are all in tabulars, that's fine. But otherwise, it is wrong. Also, it is better to say \includegraphics{koala1} without the extension. – cfr Feb 20 '17 at 23:24
  • Thanks for your advice - I'm still getting to grips with LaTeX having been away from it for nearly 15 years. – C. de Haer Feb 22 '17 at 09:40