乳胶中的值列表
List of values in latex
我正在更新用 Latex 编写的文档,我必须实现一种框,其中包含指定项目的可能值列表和默认值。
Tex 文件已经包含一些预定义的结构。
有一个条目,由 \newcommand 定义,它接受输入参数并创建一个框。
它用于以下方式:
%Input values {Min & Max & Default}:
{0 & 1 & 0}
在最终的 pdf 文件中,此结构转换为下一个表示形式:
据我了解,它在下一段代码中实现:
\makebox[\linewidth][r]{
\begin{tabular}{llll}
Input values: & \mitalic{Min} & \mitalic{Max} & \mitalic{Default} \ & #8 \
& & & \
\end{tabular}
}
我的目标是实现与下一个结果类似的东西:
此处可能值的数量可以不同。
我以前没有任何乳胶经验,如果对你们中的某些人来说这是一个愚蠢的问题,我很抱歉。
更新(2015 年 8 月 19 日):
我已经使用下一个构造来实现我的目标(有关更多信息,请参阅答案 here):
\newcommand{\ParseOptMenuItemList}[1]
{
\def\tmplist{#1}%
\@tempcnta=\z@
\@for\tmp:=\tmplist\do{\advance\@tempcnta\@ne
\expandafter\let\csname temp\@roman\@tempcnta\endcsname\tmp
}%
\makebox[\linewidth][r]{%
\begin{tabular}{lc}
Possible values: \ifthenelse{\equal{\tempi}{}}{}{& \tempi\}
\ifthenelse{\equal{\tempii}{}}{}{& \tempii\}
\ifthenelse{\equal{\tempiii}{}}{}{& \tempiii\}
\ifthenelse{\equal{\tempiv}{}}{}{& \tempiv\}
\ifthenelse{\equal{\tempv}{}}{}{& \tempv\}
\ifthenelse{\equal{\tempvi}{}}{}{& \tempvi\}
\ifthenelse{\equal{\tempvii}{}}{}{& \tempvii\}
\ifthenelse{\equal{\tempviii}{}}{}{& \tempviii\}
\ifthenelse{\equal{\tempix}{}}{}{& \tempix\}
\ifthenelse{\equal{\tempx}{}}{}{& \tempx\}
\ifthenelse{\equal{\tempxi}{}}{}{& \tempxi\}
\ifthenelse{\equal{\tempxii}{}}{}{& \tempxii\}
\ifthenelse{\equal{\tempxiii}{}}{}{& \tempxiii\}
\ifthenelse{\equal{\tempxiv}{}}{}{& \tempxiv\}
\ifthenelse{\equal{\tempxv}{}}{}{& \tempxv\}
\ifthenelse{\equal{\tempxvi}{}}{}{& \tempxvi\}
\ifthenelse{\equal{\tempxvii}{}}{}{& \tempxvii\}
\ifthenelse{\equal{\tempxviii}{}}{}{& \tempxviii\}
Default value: & \tempxix\
\end{tabular}
}
}
尝试编译以下最小示例:
\documentclass{article}
\newcommand{\inputvals}[5]{%
\makebox[\linewidth][r]{%
\begin{tabular}{lc}
Possible values: & #1\
& #2\
& #3\
& #4\[.7em]
Default value: & #5\
\end{tabular}
}}
\begin{document}
\inputvals{x}{y}{z}{t}{u}
\end{document}
这应该会给出与您的要求非常相似的内容。注意在preamble(在\begin{document}
之前)使用\newcommand
定义了一个命令\inputvals
,然后在\inputvals
中使用了\inputvals
指定其 5 个参数的文档。让我们知道此实施是否符合您的要求。
我正在更新用 Latex 编写的文档,我必须实现一种框,其中包含指定项目的可能值列表和默认值。
Tex 文件已经包含一些预定义的结构。
有一个条目,由 \newcommand 定义,它接受输入参数并创建一个框。
它用于以下方式:
%Input values {Min & Max & Default}:
{0 & 1 & 0}
在最终的 pdf 文件中,此结构转换为下一个表示形式:
据我了解,它在下一段代码中实现:
\makebox[\linewidth][r]{
\begin{tabular}{llll}
Input values: & \mitalic{Min} & \mitalic{Max} & \mitalic{Default} \ & #8 \
& & & \
\end{tabular}
}
我的目标是实现与下一个结果类似的东西:
此处可能值的数量可以不同。
我以前没有任何乳胶经验,如果对你们中的某些人来说这是一个愚蠢的问题,我很抱歉。
更新(2015 年 8 月 19 日):
我已经使用下一个构造来实现我的目标(有关更多信息,请参阅答案 here):
\newcommand{\ParseOptMenuItemList}[1]
{
\def\tmplist{#1}%
\@tempcnta=\z@
\@for\tmp:=\tmplist\do{\advance\@tempcnta\@ne
\expandafter\let\csname temp\@roman\@tempcnta\endcsname\tmp
}%
\makebox[\linewidth][r]{%
\begin{tabular}{lc}
Possible values: \ifthenelse{\equal{\tempi}{}}{}{& \tempi\}
\ifthenelse{\equal{\tempii}{}}{}{& \tempii\}
\ifthenelse{\equal{\tempiii}{}}{}{& \tempiii\}
\ifthenelse{\equal{\tempiv}{}}{}{& \tempiv\}
\ifthenelse{\equal{\tempv}{}}{}{& \tempv\}
\ifthenelse{\equal{\tempvi}{}}{}{& \tempvi\}
\ifthenelse{\equal{\tempvii}{}}{}{& \tempvii\}
\ifthenelse{\equal{\tempviii}{}}{}{& \tempviii\}
\ifthenelse{\equal{\tempix}{}}{}{& \tempix\}
\ifthenelse{\equal{\tempx}{}}{}{& \tempx\}
\ifthenelse{\equal{\tempxi}{}}{}{& \tempxi\}
\ifthenelse{\equal{\tempxii}{}}{}{& \tempxii\}
\ifthenelse{\equal{\tempxiii}{}}{}{& \tempxiii\}
\ifthenelse{\equal{\tempxiv}{}}{}{& \tempxiv\}
\ifthenelse{\equal{\tempxv}{}}{}{& \tempxv\}
\ifthenelse{\equal{\tempxvi}{}}{}{& \tempxvi\}
\ifthenelse{\equal{\tempxvii}{}}{}{& \tempxvii\}
\ifthenelse{\equal{\tempxviii}{}}{}{& \tempxviii\}
Default value: & \tempxix\
\end{tabular}
}
}
尝试编译以下最小示例:
\documentclass{article}
\newcommand{\inputvals}[5]{%
\makebox[\linewidth][r]{%
\begin{tabular}{lc}
Possible values: & #1\
& #2\
& #3\
& #4\[.7em]
Default value: & #5\
\end{tabular}
}}
\begin{document}
\inputvals{x}{y}{z}{t}{u}
\end{document}
这应该会给出与您的要求非常相似的内容。注意在preamble(在\begin{document}
之前)使用\newcommand
定义了一个命令\inputvals
,然后在\inputvals
中使用了\inputvals
指定其 5 个参数的文档。让我们知道此实施是否符合您的要求。