GeneralHow to link two enumerate list in LaTeX.

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
texla
Posts: 3
Joined: Sun Nov 01, 2020 3:10 am

How to link two enumerate list in LaTeX.

Post by texla »

I have two enumerate lists with n items each. What I want to do is link these two list in such that if:

a) i move item 3 up/down from the first list, item 3 from the second list will also move up/down.
b) i remove item 3 from the first list, item 3 from the second list will also be removed.

I have a sample MWE:

Code: Select all

\documentclass{article}
\usepackage{enumitem}

\begin{document}
% First list and the only list I make changes to.
\begin{enumerate}
    \item This is item 1. %  this item is linked to --> 1) 
    \item This is item 2.  % this item is linked to --> 2) 
    \item This is item 3. % this item is linked to --> 3) 
    \item This is item 4. % this item is linked to --> 4) 
\end{enumerate}
% Second list 
\begin{enumerate}
    \item 1)
    \item  2) 
    \item 3)
    \item 4)
\end{enumerate}
\end{document}
So for example :

Code: Select all

\documentclass{article}
\usepackage{enumitem}

\begin{document}

\begin{enumerate}
    \item This is item 1. %  this item is linked to --> 1) 
    \item This is item 3. % this item is linked to --> 3)   % I  moved item 3 up by one
    \item This is item 2.  % this item is linked to --> 2) 
     \item This is item 4. % this item is linked to --> 4) 
\end{enumerate}

\begin{enumerate}
    \item 1)
    \item 3)
    \item  2) 
    \item 4)
\end{enumerate}
\end{document}
Any help/direction will be greatly appreciated.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

How to link two enumerate list in LaTeX.

Post by Bartman »

There is a crosspost.

You could use the answer to a similar question and adapt it.

If this is to be a compilation of tasks and solutions for an exercise or an exam, you will find packages on the CTAN website that will help you produce them.
texla
Posts: 3
Joined: Sun Nov 01, 2020 3:10 am

How to link two enumerate list in LaTeX.

Post by texla »

Hi Bartman,

Yes i've had a look at the and tried to modify it but I can't seem to make it work with my list.

As for CTAN, do you know what I need to search for in order to modify it and achieve my objective?
Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

How to link two enumerate list in LaTeX.

Post by Bartman »

Since we don't know what you can't get to work, you would have to offer us an adapted Infominimal working example that lets us understand your problem.

Depending on what these lists are to be used for, the use of e.g. xsim could mean an exaggerated large adjustment effort compared to the linked answer.
texla
Posts: 3
Joined: Sun Nov 01, 2020 3:10 am

How to link two enumerate list in LaTeX.

Post by texla »

All I have is examples from else where but it involves setting out questions using \begin{question} and then followed by \begin{solutions}. But I am not interested in a question/solution.

My problem is i can't find information on how do i 'pair' or 'link' two enumerate lists in latex.

In short, I don't have a working MWE to provide you because I need direction. Also I've had a look at CTAN, namely xsim and answer package but they don't really deal with lists.
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

How to link two enumerate list in LaTeX.

Post by Ijon Tichy »

You cannot use wood to build an iron shield.

The output of an enumeration list is always in the order of the items in the source. So if you want to reorder the output, you have to use a construct that provides reordering, e.g., something like questions and solutions as explained above.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Post Reply