LaTeX forum ⇒ GeneralHow to link two enumerate list in LaTeX.

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

How to link two enumerate list in LaTeX.

Postby texla » Sun Nov 01, 2020 3:22 am

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:

\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 :
\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.

Bartman
Posts: 228
Joined: Fri Jan 03, 2020 2:39 pm

Postby Bartman » Sun Nov 01, 2020 6:23 am

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

Postby texla » Sun Nov 01, 2020 7:55 am

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: 228
Joined: Fri Jan 03, 2020 2:39 pm

Postby Bartman » Sun Nov 01, 2020 9:33 am

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

Postby texla » Sun Nov 01, 2020 10:21 am

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: 548
Joined: Mon Dec 24, 2018 10:12 am

Postby Ijon Tichy » Sun Nov 01, 2020 1:16 pm

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.


Return to “General”

Who is online

Users browsing this forum: No registered users and 7 guests