1

I want to list many reactions and I created an environment (which I find nice, but if you have a better idee... do not hesitate ^^)

\newsavebox{\mybox}
\newenvironment{reactions}
{\begin{lrbox}{\mybox}
\newcommand{\reaction}[2]{ \item [- ##1] : ##2  }
\begin{minipage}{\linewidth - 2\fboxsep - 2\fboxrule}
\begin{enumdescript}}
{\end{enumdescript}
\end{minipage}
\end{lrbox}\fbox{\usebox{\mybox}}}

enumdescript is enumerate and description environment (see bellow)

Thanks to those who helped me by helping others, I wanted to vote for the answers but I've not enough reputation...

But I have many reactions. Too many and one minipage is not enough. I know I can create a second reaction environment but it's not practical and the second numerotation will start to one.

\begin{reactions}
 first reactions
\end{reactions}
\begin{reactions}
 last reactions
\end{reactions}

But I wonder if it's possible to do this automatically...

Thank you

Ccile

PS1 : Sorry for the mistakes, do not hesitate to correct me

PS2 : here is the entire code with fake reactions if you need.

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{multirow}
\usepackage{pdfpages}
\usepackage{array}
\usepackage{longtable}
\usepackage{enumitem}

%Liste enumerate et description
\newcounter{descriptcount}  
\newlist{enumdescript}{description}{2}
\setlist[enumdescript,1]{%
  before={\setcounter{descriptcount}{0}%
      \renewcommand*\thedescriptcount{\arabic{descriptcount}}}
  ,font=\bfseries\stepcounter{descriptcount}\thedescriptcount~
}
\setlist[enumdescript,2]{%
  before={\setcounter{descriptcount}{0}%
          \renewcommand*\thedescriptcount{\roman{descriptcount}}}
  ,font=\bfseries\stepcounter{descriptcount}\thedescriptcount~
}
%Fleches rev irrev
\newcommand\irrev{\(\rightarrow \ \)}
\newcommand\rev{\(\leftrightarrow \ \)}

%Environnement reactions
\newsavebox{\mybox}
\newenvironment{reactions}
{\begin{lrbox}{\mybox}
\newcommand{\reaction}[2]{ \item [- ##1] : ##2  }
\begin{minipage}{\linewidth - 2\fboxsep - 2\fboxrule}
\begin{enumdescript}}
{\end{enumdescript}
\end{minipage}
\end{lrbox}\fbox{\usebox{\mybox}}}


\begin{document}


\section{Les réactions}
    \begin{reactions}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
    \end{reactions}
\end{document}
2

With a breakable tcolorbox you can do:

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{multirow}
\usepackage{pdfpages}
\usepackage{array}
\usepackage{longtable}
\usepackage{enumitem}
\usepackage[most]{tcolorbox}

%Liste enumerate et description
\newcounter{descriptcount}  
\newlist{enumdescript}{description}{2}
\setlist[enumdescript,1]{%
  before={\setcounter{descriptcount}{0}%
      \renewcommand*\thedescriptcount{\arabic{descriptcount}}}
  ,font=\bfseries\stepcounter{descriptcount}\thedescriptcount~
}
\setlist[enumdescript,2]{%
  before={\setcounter{descriptcount}{0}%
          \renewcommand*\thedescriptcount{\roman{descriptcount}}}
  ,font=\bfseries\stepcounter{descriptcount}\thedescriptcount~
}
%Fleches rev irrev
\newcommand\irrev{\(\rightarrow \ \)}
\newcommand\rev{\(\leftrightarrow \ \)}

%Environnement reactions
%\newsavebox{\mybox}
%\newenvironment{reactions}
%{\begin{lrbox}{\mybox}

%\begin{minipage}{\linewidth - 2\fboxsep - 2\fboxrule}
%\begin{enumdescript}}
%{\end{enumdescript}
%\end{minipage}
%\end{lrbox}\fbox{\usebox{\mybox}}}

\newtcolorbox{reactions}{breakable, 
colback=white, sharp corners,
before upper={\begin{enumdescript}},
after upper={\end{enumdescript}}}

\newcommand{\reaction}[2]{ \item [- #1] : #2  }

\begin{document}


\section{Les réactions}
    \begin{reactions}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
\reaction{name}{A + B + C + D + E \irrev F + G + H + I + J}
    \end{reactions}
\end{document}

enter image description here

  • Thank you !! Just another question : if I want to break by hand, I need to use the trick described in the manual (ctan.math.utah.edu/ctan/tex-archive/macros/latex/contrib/… page 375) or is there another way ? (Not the subject of the post, it's just curiosity ) And how do you show the output of the code ? I didn't find it ... Thanks again, and to everyone. Ccile – Ccile Dec 15 '16 at 13:11
  • @Ccile What does break by hand mean? You can close with \end{reactions} when you want and start again another reactions list. – Ignasi Dec 15 '16 at 20:18
  • If I close with \end{reactions} it will start another list, with a new number 1. By break by hand I meant choose to write for instance reactions 1 to 20 and on another page 20 to 40. – Ccile Dec 16 '16 at 14:38
  • @Ccile If you close with \end{reactions}, the new list starts with 1 because you are using \setcounter{descriptcount}{0} in your definition. This way any new list will start with 1. enumitem offers resume option to break and continue list. But this option won't work with your code. If you need to resume broken lists, i think you should try to find an alternative code for enumdescript. – Ignasi Dec 19 '16 at 10:22
  • thanks. I was just a question, I don't need to break and continue the list. But I suppose I can change the setcounter and put an optional parameter : if no parameter, the counter starts with 1, if there is a parameter, starts with the value given by the parameter – Ccile Dec 19 '16 at 10:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.