latex中的值列表
我正在更新用latex编写的文档,我必须实现一种包含指定项的可能值和默认值列表的框 Tex文件已经包含一些预定义的结构 有一个条目由\newcommand定义,它接受输入参数并创建一个框。latex中的值列表,latex,Latex,我正在更新用latex编写的文档,我必须实现一种包含指定项的可能值和默认值列表的框 Tex文件已经包含一些预定义的结构 有一个条目由\newcommand定义,它接受输入参数并创建一个框。 它的使用方式如下: %Input values {Min & Max & Default}: {0 & 1 & 0} 在最终的pdf文件中,此结构转换为下一个表示: 据我所知,它将在下一段代码中实现: \makebox[\linewidth][r]{ \be
它的使用方式如下:
%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日):
我已经使用下一步构建来实现我的目标(更多信息请参见答案):
尝试编译以下最小示例:
\documentclass{article}
\新命令{\inputvals}[5]{%
\生成框[\linewidth][r]{%
\开始{表格}{lc}
可能值:\\
& #2\\
& #3\\
\\[.7em]
默认值:\\
\结束{表格}
}}
\开始{document}
\输入值{x}{y}{z}{t}{u}
\结束{document}
这应该会给出与你所要求的非常相似的东西。请注意,在序言中(在\begin{document}
之前)使用\newcommand
定义了命令\inputvals
,然后在指定其5个参数的文档中使用\inputvals
。让我们知道此实现是否符合您的要求
\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}
}
}