Text FormattingItemised lists and numbering labels

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
couperc
Posts: 9
Joined: Fri Apr 09, 2010 3:31 pm

Itemised lists and numbering labels

Post by couperc »

Hi

I'm trying to create inline numbered lists but I want the number of the labels to increse. The MWE below contains the current method I'm using.

Code: Select all

\documentclass[12pt]{article}
\usepackage{paralist}

\begin{document}

The beans used were \begin{inparaenum} \item \label{b1} haricot and \item \label{b2} runner!. \end{inparaenum}

If we use Bean \ref{b2} with a hybrid of bean \ref{b1} we can obtain mash!

However if we also have \begin{inparaenum} \item \label{b3} fava and \item \label{b4} broad beans, the use of the method is flawed. \end{inparaenum}

If we use \ref{b3} and \ref{b4} we can end up in trouble.

\end{document}

However, instead of the output reading (I'm using pdflatex here)
The beans used were 1. haricot and 2. runner!.
If we use Bean 2 with a hybrid of bean 1 we can obtain mash!
However if we also have 1. fava and 2. broad beans, the use of the
method is flawed.
If we use 1 and 2 we can end up in trouble.
I would like it to read:
The beans used were 1. haricot and 2. runner!.
If we use Bean 2 with a hybrid of bean 1 we can obtain mash!
However if we also have 1. fava and 2. broad beans, the use of the
method is flawed.
If we use Bean 3 and Bean 4 we can end up in trouble.
I do want to keep the 1. blah blah 2. blah blah format of both inline lists.

Any help most appreciated :D

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Itemised lists and numbering labels

Post by frabjous »

I'm assuming what you actually want is:
The beans used were 1. haricot and 2. runner!.
If we use Bean 2 with a hybrid of bean 1 we can obtain mash!
However if we also have 3. fava and 4. broad beans, the use of the
method is flawed.
If we use Bean 3 and Bean 4 we can end up in trouble.
... since what you asked for doesn't make much sense.

If so, it seems like you could do what you want just using a counter rather than a list. For example:

Code: Select all

\documentclass[12pt]{article}
\newcounter{beancounter}
\setcounter{beancounter}{0}
\newcommand{\beanitem}[1]{\refstepcounter{beancounter}\thebeancounter.\label{#1}}

\usepackage{paralist}

\begin{document}

The beans used were \beanitem{b1} haricot and \beanitem{b2} runner!

If we use Bean \ref{b2} with a hybrid of Bean \ref{b1} we can obtain mash!

However if we also have \beanitem{b3} fava and \beanitem{b4} broad beans, the use of the method is flawed.

If we use Bean \ref{b3} and Bean \ref{b4} we can end up in trouble.

\end{document}
couperc
Posts: 9
Joined: Fri Apr 09, 2010 3:31 pm

Itemised lists and numbering labels

Post by couperc »

Just following on from this, I seem to be getting strange behaviour when i use this label in tables. See the example below:

Code: Select all

\documentclass[12pt]{report}
\usepackage[footnotesize]{caption}
\usepackage{graphicx}
\usepackage{tabulary}
\usepackage{geometry}
\geometry{top=20mm, bottom=20mm, left=35mm, right=20mm}
\linespread{1.5}

\begin{document}
\newcounter{fluidcounter}
\setcounter{fluidcounter}{0}
\newcommand{\fluid}[1]{\refstepcounter{fluidcounter}\thefluidcounter\label{#1}}



I define a few fluids sucah as Sample \fluid{s1} and Sample \fluid{s2} and maybe even Sample \fluid{s3}
I then want to define a number of fluisds with proerties, so i use this:
\begin{table}[ht]
\caption{Table of Fluids measured}
\begin{tabulary}{0.75\textwidth}{|l|l|l|l|l|l|}
\hline
Sample & Location & Carrier & Material & Mean Radius & Saturation Magnetisation \\ \hline
\hline
\fluid{s4} & Mexico & Isopar-M & Mn$_{0.3}$Fe$_{0.7}$Fe$_{3}$0$_{4}$ & 5nm & .04 T \\ \hline
\fluid{s5} & Commercial & kerosene & Magnetite & 5nm & .09 T \\ \hline
\fluid{s6} & Romania (A3) & Isopar-M & Magnetite & 5nm & .04 T \\ \hline
\fluid{s7} & France (Ademtech) & Isopar-M & Magnetite & 5nm & .09 T \\ \hline
\fluid{s8} & Commercial, German (EMG901) & Isoparaffin & Magnetite & 5nm & .06 T \\ \hline
\fluid{s9} & Commercial, German (EMG905) & Isoparaffin & Magnetite & 5nm & .04 T \\ \hline
\fluid{s10} & Russia & Isoparaffin & Magnetite & 5nm & .06 T \\ \hline
\fluid{s11} & Commerical, Wales (EFH1)& Mineral oil & Magnetite & 5nm & .04 T \\ \hline
\fluid{s11} & Germany (Space01) & Isoparaffin & Cobalt ferrite & 5nm & .06 T \\ \hline
\hline
\end{tabulary}
\label{tr1}
\end{table}
\end{document}
as you can see it jumps from 3 to 13 rather than continue counting. Anyone any suggestions on how to fix this?
Post Reply