似乎使用align*
insideenumerate*
会导致 PDFLaTeX 挂起。有人能解释原因和/或建议解决方法吗
最小示例
\documentclass[11pt]{extarticle}
\usepackage[inline, shortlabels]{enumitem}
\usepackage{amssymb, amsmath}
\begin{document}
\begin{enumerate*}
\item
\begin{align*}
abc &= def
\end{align*}
\end{enumerate*}
\end{document}
解释一下我需要这个做什么。我用它align*
来创建带有注释步骤的方程式 - 例如用于填空方程求解。我使用以下宏来执行此操作
\newcommand\rightcomment[5][0.3]%
{\begin{tikzpicture}[remember picture,overlay]
\draw[-stealth]
($({pic cs:#4}|-{pic cs:#2})+(#1,0)$)
.. controls +(0.2,-0.05) and +(0.2,0.1) ..
node[right,align=left]{#5}
($({pic cs:#4}|-{pic cs:#3})+(#1,0.1)$);
\end{tikzpicture}%
}
\newcommand\leftcomment[5][-0.1]%
{\begin{tikzpicture}[remember picture,overlay]
\draw[-stealth]
($({pic cs:#4}|-{pic cs:#2})+(#1,0)$)
.. controls +(-0.2,-0.05) and +(-0.2,0.1) ..
node[left,align=right]{#5}
($({pic cs:#4}|-{pic cs:#3})+(#1,0.1)$);
\end{tikzpicture}%
}
\newcommand\twostep[9]{
\begin{align*}
\tikzmark{la#1} #2 &= #3 \tikzmark{ra#1}\\
\tikzmark{lb#1} #5 &= #6 \tikzmark{rb#1}\\
\tikzmark{lc#1} #8 &= #9 \tikzmark{rc#1}
\end{align*}
\leftcomment{la#1}{lb#1}{la#1}{$(#4)$}
\leftcomment{lb#1}{lc#1}{la#1}{$(#7)$}
\rightcomment{ra#1}{rb#1}{ra#1}{$(#4)$}
\rightcomment{rb#1}{rc#1}{ra#1}{$(#7)$}
}
用法如下:
\twostep{a}{5y + 1}{21}
{-1}{5y}{20}
{\div 5}{y}{4}
这将呈现如下输出:
然后,我使用以下宏按行主序在网格中布局枚举问题
\usepackage{tabto}
\usepackage[inline, shortlabels]{enumitem}
\newenvironment{tabbedenum}[1]
{\noindent\NumTabs{#1}\begin{enumerate*}[itemjoin={\tab}]}{\end{enumerate*}}
这给了我一个很好的按行排列的问题网格结构:
答案1
align*
是错误的工具:您需要aligned
。
此外,您需要为箭头和标签保留足够的空间,因为\tikzmark
它们的宽度不会被人知道。
\documentclass[11pt]{article}
\usepackage[inline, shortlabels]{enumitem}
\usepackage{amssymb, amsmath}
\usepackage{tikz}
\usetikzlibrary{calc,tikzmark}
\newcommand\rightcomment[5][0.3]%
{\begin{tikzpicture}[remember picture,overlay]
\draw[-stealth]
($({pic cs:#4}|-{pic cs:#2})+(#1,0)$)
.. controls +(0.2,-0.05) and +(0.2,0.1) ..
node[right,align=left]{#5}
($({pic cs:#4}|-{pic cs:#3})+(#1,0.1)$);
\end{tikzpicture}%
}
\newcommand\leftcomment[5][-0.1]%
{\begin{tikzpicture}[remember picture,overlay]
\draw[-stealth]
($({pic cs:#4}|-{pic cs:#2})+(#1,0)$)
.. controls +(-0.2,-0.05) and +(-0.2,0.1) ..
node[left,align=right]{#5}
($({pic cs:#4}|-{pic cs:#3})+(#1,0.1)$);
\end{tikzpicture}%
}
\newcommand\twostep[9]{%
$\qquad\qquad\begin{aligned}[t]
\tikzmark{la#1} #2 &= #3 \tikzmark{ra#1}\\
\tikzmark{lb#1} #5 &= #6 \tikzmark{rb#1}\\
\tikzmark{lc#1} #8 &= #9 \tikzmark{rc#1}
\end{aligned}\qquad\qquad$%
\leftcomment{la#1}{lb#1}{la#1}{$(#4)$}%
\leftcomment{lb#1}{lc#1}{la#1}{$(#7)$}%
\rightcomment{ra#1}{rb#1}{ra#1}{$(#4)$}%
\rightcomment{rb#1}{rc#1}{ra#1}{$(#7)$}%
}
\begin{document}
\begin{enumerate}
\item
\begin{enumerate*}
\item
\twostep{a}{5y + 1}{21}
{-1}{5y}{20}
{\div 5}{y}{4}
\item
\twostep{b}{5y + 1}{21}
{-1}{5y}{20}
{\div 5}{y}{4}
\end{enumerate*}
\end{enumerate}
\end{document}
答案2
尝试unboxed
模式:
\begin{enumerate*}[mode=unboxed]
\item
\begin{align*}
abc &= def
\end{align*}
\end{enumerate*}
非常不幸,我决定将该boxed
模式设为默认模式。
答案3
我认为你不需TikZ
要这样做:一些箭头MnSymbol
和一个alignedat
环境就可以完成这项工作。
至于水平枚举,其自然环境应该是tasks
包及其同名环境。不幸的是,它不能嵌套。我提出了另一种解决方案,基于shortlst
定义shortenumerate
环境的包,我对其进行了调整,以使列数成为可选参数(3
默认情况下)。
请注意,我认为由于许可原因,此软件包不是 TeX Live 或 MiKTeX 的一部分,因此您必须从 CTAN 下载它并手动将其安装在您的 TeXMF 本地目录中。
以下是一个例子:
\documentclass[11pt]{extarticle}
\usepackage{geometry}
\usepackage[inline, shortlabels]{enumitem}
\usepackage{tasks}
\usepackage{amssymb, mathtools}
\usepackage{relsize}
\DeclareFontFamily{U} {MnSymbolA}{}
\DeclareSymbolFont{MnSyA} {U} {MnSymbolA}{m}{n}
\SetSymbolFont{MnSyA} {bold}{U} {MnSymbolA}{b}{n}
\DeclareFontShape{U}{MnSymbolA}{m}{n}{
<-6> MnSymbolA5
<6-7> MnSymbolA6
<7-8> MnSymbolA7
<8-9> MnSymbolA8
<9-10> MnSymbolA9
<10-12> MnSymbolA10
<12-> MnSymbolA12}{}
\DeclareFontShape{U}{MnSymbolA}{b}{n}{
<-6> MnSymbolA-Bold5
<6-7> MnSymbolA-Bold6
<7-8> MnSymbolA-Bold7
<8-9> MnSymbolA-Bold8
<9-10> MnSymbolA-Bold9
<10-12> MnSymbolA-Bold10
<12-> MnSymbolA-Bold12}{}
\DeclareMathSymbol{\rcurvearrowdown}{\mathrel}{MnSyA}{"C3}%{"FD}
\DeclareMathSymbol{\lcurvearrowdown}{\mathrel}{MnSyA}{"BB}%
\usepackage{shortlst}
\newenvironment{tabenumerate}[1][3]{%
\renewcommand{\theenumii}{$\alph{enumii}$}
\settowidth{\labelwidth}{\labelenumii}%
\setlength{\leftmarginii}{\dimexpr\parindent + \labelwidth + \labelsep\relax}%
\setlength{\shortitemwidth}{\dimexpr\linewidth/#1-\labelwidth-2\labelsep\relax}%
\begin{shortenumerate}}%
{\end{shortenumerate}}%
\newcommand{\leftcomment}[1]{\raisebox{1.2ex}[0pt]{$ (#1)$}\raisebox{0.9ex}[0pt]{$\scalebox{1.4}{$ \rcurvearrowdown $}\: $}}
\newcommand{\rightcomment}[1]{\raisebox{0.9ex}[0pt]{$\scalebox{1.4}{$ \: \lcurvearrowdown $}$}\raisebox{1.2ex}[0pt]{$(#1)$}}
\begin{document}
\begin{enumerate}[labelsep = 1.3em]
\item
\begin{tabenumerate}[2]
\item $ \begin{alignedat}[t]{3}
& & 5y + 1 &= 21\\
\leftcomment{-1}
& & 5y & =20 & & \rightcomment{-1}\\
\leftcomment{\div 5} & & y & =4 & & \rightcomment{\div5}
\end{alignedat} $
\item $ \begin{alignedat}[t]{3}
& & 6y + 3 &= 21\\
\leftcomment{-3}
& & 6y & =18 & & \rightcomment{-3}\\
\leftcomment{\div 6} & & y & =3 & & \rightcomment{\div6}
\end{alignedat} $
\end{tabenumerate}
\end{enumerate}
\end{document}