是否有一个包可以自动对齐和编号一系列计算?

是否有一个包可以自动对齐和编号一系列计算?

这就是我目前对包alignat环境所做的工作amsmath。但我发现语法很繁琐,不太方便用户使用。我希望a) ... b) ... c) 每行的编号都是自动的,并且列之间的间距易于配置。

有没有可以自动对齐和编号一系列具有简单且用户友好的语法的计算?

截屏

\documentclass[french,landscape]{article}   
\usepackage[margin=6mm]{geometry}
\usepackage{amsmath}
\usepackage{multicol}
\setlength\columnsep{10mm}
\setlength\columnseprule{.4pt}
\raggedcolumns 

\begin{document}
\pagestyle{empty}

\setlength{\abovedisplayskip}{0pt}
\setlength{\belowdisplayskip}{0pt} 
\begin{multicols*}{2}
Effectuer:
\begin{alignat*}{3}
& a)\ (+7)+(-12)   \quad&&\quad b)\ (-7)+(+12)    \quad&&\quad c)\ (-7)+(-12) \\   
& d)\ (+9)+(-5)    \quad&&\quad e)\ (-4)+(+10)    \quad&&\quad f)\ (-12)+(-10)\\    
& g)\ (+9)+(-9)    \quad&&\quad h)\ (+12)+(-18)   \quad&&\quad i)\ (-20)+(+16)      
 \end{alignat*}
\columnbreak 

 Effectuer:
\begin{alignat*}{3}
& a)\ (+3)+(-18)   \quad&&\quad b)\ (-7)+(+12)    \quad&&\quad c)\ (-7)+(-12) \\   
& d)\ (+7)+(-5)    \quad&&\quad e)\ (-6)+(+13)    \quad&&\quad f)\ (-12)+(-10)\\    
& g)\ (+9)+(-9)    \quad&&\quad h)\ (+12)+(-18)   \quad&&\quad i)\ (-20)+(+16)      
 \end{alignat*}
 \end{multicols*}
\end{document}

答案1

以下是四种不同包装的比较。我认为我tasks最喜欢的是这四种。

\documentclass{article}

\usepackage{url}
\usepackage{shortlst}
\usepackage{hlist}
\usepackage{tasks}
\usepackage{multienum}

\begin{document}

\section*{A comparison of horizontal list packages}

\subsection*{shortlst}

\texttt{shortlst} has a non-free licence, so you will need to grab it from
CTAN at \url{https://ctan.org/pkg/shortlst}.

Also, it uses the standard \LaTeX{} labels without easy customisation, so you
have to use a hook to redefine them if you want something else.

\AddToHook{env/shortenumerate/begin}{%
  \renewcommand\theenumi{\alph{enumi}}%
  \renewcommand\labelenumi{\emph{\theenumi})}}

The width of items is calculated automatically to maximise the number of items
per line, but you can set the item width manually using
\verb|\shortitemwidth|.

\begin{shortenumerate}
  \item $(+7)+(-12)$
  \item $(-7)+(+12)$
  \item $(-7)+(-12)$
  \item $(+9)+(-5)$
  \item $(-4)+(+10)$
  \item $(-12)+(-10)$
  \item $(+9)+(-9)$
  \item $(+12)+(-18)$
  \item $(-20)+(+16)$
\end{shortenumerate}

\subsection*{hlist}

\texttt{hlist} seems to work pretty well and his a flexible interface to set
the list parameters. The defaults are not very much like the default \LaTeX{}
lists so I had to fiddle with them a bit.

\sethlist{label sep=0.5em, item offset=2.5em, label width=2em, pre label={},
  label={\emph{\alph{hlisti}})}, label align=right}

\begin{hlist}3
  \hitem $(+7)+(-12)$
  \hitem $(-7)+(+12)$
  \hitem $(-7)+(-12)$
  \hitem $(+9)+(-5)$
  \hitem $(-4)+(+10)$
  \hitem $(-12)+(-10)$
  \hitem $(+9)+(-9)$
  \hitem $(+12)+(-18)$
  \hitem $(-20)+(+16)$
\end{hlist}

\subsection*{tasks}

\texttt{tasks} seems to be the most actively maintained package and has a good
interface for modifying list settings. Default settings are reasonably close
to the standard \LaTeX{} lists.

\settasks{label=\emph{\alph*}), label-align=right, label-offset=0.5em,
after-item-skip=-\parsep}

\begin{tasks}(3)
  \task $(+7)+(-12)$
  \task $(-7)+(+12)$
  \task $(-7)+(-12)$
  \task $(+9)+(-5)$
  \task $(-4)+(+10)$
  \task $(-12)+(-10)$
  \task $(+9)+(-9)$
  \task $(+12)+(-18)$
  \task $(-20)+(+16)$
\end{tasks}

\subsection*{multienum}

\texttt{multienum} uses a somewhat different interface, but still seems to
work fairly well.

There's no interface to customise labels and spacing though, so need to
redefine things manually. Except I couldn't find an easy way of modifying the
spacing between rows.

\renewcommand{\regularlisti}{%
  \setcounter{multienumi}{0}%
  \renewcommand{\labelenumi}{%
    \addtocounter{multienumi}{1}\emph{\alph{multienumi}})}}

\begin{multienumerate}
  \setlength{\parskip}{0pt}%
  \setlength{\itemsep}{0pt}%
  \mitemxxx{$(+7)+(-12)$}{$(-7)+(+12)$}{$(-7)+(-12)$}
  \mitemxxx{$(+9)+(-5)$}{$(-4)+(+10)$}{$(-12)+(-10)$}
  \mitemxxx{$(+9)+(-9)$}{$(+12)+(-18)$}{$(-20)+(+16)$}
\end{multienumerate}

\end{document}

输出

答案2

包裹怎么样tasks

在此处输入图片描述

\documentclass{article}   
\usepackage{amsmath}
\usepackage{tasks}
\begin{document}

Effectuer:
\begin{tasks}[item-format=\ensuremath](3)
    \task (+7)+(-12)
    \task (-7)+(+12)
    \task (-7)+(-12)
    \task (+9)+(-5)
    \task (-4)+(+10)
    \task (-12)+(-10)
    \task (+9)+(-9)
    \task (+12)+(-18)
    \task (-20)+(+16)
\end{tasks}

\end{document}

答案3

也许,这是最后的手段!

\documentclass[12pt]{article}
\usepackage[a5paper,margin=1cm,landscape]{geometry}
\usepackage{amsmath}
\usepackage{enumitem}
\usepackage{multicol}
\begin{document}



Effectuer:
\begin{multicols}{3}
\begin{enumerate}[label=\alph*)]
    \item $K+i+m$
    \item $J+o+n+g$
    \item $U+n$
    \item $P+e+a+c+e$
    \item $B+e$
    \item $U+p+o+n$
    \item $M+e$
    \item $\cdots$
    \item $\cdots$
\end{enumerate}
\end{multicols}
 

\end{document}

在此处输入图片描述

相关内容