![如何在逐項清單中新增條件?](https://rvso.com/image/281564/%E5%A6%82%E4%BD%95%E5%9C%A8%E9%80%90%E9%A0%85%E6%B8%85%E5%96%AE%E4%B8%AD%E6%96%B0%E5%A2%9E%E6%A2%9D%E4%BB%B6%EF%BC%9F%20.png)
下面提到的清單包含三項。有四個變數: 1] varone 2] vartwo 3] var Three 和 4] sub ;它們來自外部 CSV 檔案。如果變數 sub 的值大於 4,則會顯示帶有「值 B」的項目 2。
\begin{itemize}
\ifboolexpr{
test {\ifdimgreater{\varone pt}{69.99pt}} or
test {\ifdimequal{\varone pt}{69.99pt}}}
{\item \textbf{Value A: } Text for A.}{}
\ifnum\sub > 4
\ifboolexpr{
test {\ifdimgreater{\vartwo pt}{69.99pt}} or
test {\ifdimequal{\vartwo pt}{69.99pt}}}
{\item \textbf{Value B: } Text for B.}{}
\fi
\ifboolexpr{
test {\ifdimgreater{\varthree pt}{69.99pt}} or
test {\ifdimequal{\varthree pt}{69.99pt}}}
{\item \textbf{Value C: } Text for C.}{}
\end{itemize}
注意:我將文章文檔類別與 xelatex 一起使用。