如何在逐項清單中新增條件?

如何在逐項清單中新增條件?

下面提到的清單包含三項。有四個變數: 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 一起使用。

相關內容