在该包的帮助下,task
您可以轻松生成具有两列或更多列的枚举列表:
- 如果你写
\begin{tasks}...
所有内容都打印在一柱子 - 如果你写
\begin{tasks}(2)...
所有内容都打印在二列 - 如果你写
\begin{tasks}(3)...
所有内容都打印在三列
我想在特定条件下显示列。我尝试了类似
\newtoggle{twocolumn}
\togglefalse{twocolumn}
% Task 3
\begin{tasks}\iftoggle{twocolumn}{}{(2)}
\task one
\task two
\task three
\task four
\end{tasks}
...但是这不起作用!
平均能量损失
\documentclass{article}
\usepackage{lipsum}
\usepackage{tasks}
\usepackage{etoolbox}
\begin{document}
% Task 1
\begin{tasks}(2)
\task one
\task two
\task three
\task four
\end{tasks}
% Task 2
\begin{tasks}
\task one
\task two
\task three
\task four
\end{tasks}
\newtoggle{twocolumn}
\togglefalse{twocolumn}
% Task 3
\begin{tasks}%\iftoggle{twocolumn}{}{(2)}
\task one
\task two
\task three
\task four
\end{tasks}
\end{document}
截屏
答案1
将条件更改iftoggle
为:
\begin{tasks}(\iftoggle{twocolumn}{2}{1})
梅威瑟:
\documentclass{article}
\usepackage{lipsum}
\usepackage{tasks}
\usepackage{etoolbox}
\begin{document}
\newtoggle{twocolumn}
\togglefalse{twocolumn} The toggle is false:
% Task 3
\begin{tasks}(\iftoggle{twocolumn}{2}{1})
\task one
\task two
\task three
\task four
\end{tasks}
\toggletrue{twocolumn} The toggle is true:
% Task 4
\begin{tasks}(\iftoggle{twocolumn}{2}{1})
\task one
\task two
\task three
\task four
\end{tasks}
\end{document}
结果: