我有这个命令(createPerson)已经有9个参数。但是,我需要它采取更多。我已阅读xargs包,但我无法弄清楚如何使用它。您能帮助我将更改应用于方法,或者提出更好的解决方案。我的最低工作代码是这样的:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{tabularx} % Til tabeller der tilpaser sig i bredden
\newcolumntype{R}{>{\raggedleft\arraybackslash}r}
\usepackage{xifthen} % Used to test if an argument is empty
\usepackage{datetime} % Used to format dates
\newdateformat{timeLineDate}{\THEDAY.~\shortmonthname~\THEYEAR}
\newdateformat{monthYearDate}{\monthname[\THEMONTH]~\THEYEAR}
%Arguments:
% 1) MANDATORY - Reference to the current full name
% 2) OPTIONAL - Full birth name
% 3) MANDATORY - Called name
% 4) MANDATORY - Birth date in the format of dd. mmm. yyyy
% 4) - Day
% 5) - Month
% 6) - Year
% 7) OPTIONAL - Death date in the format of dd. mmm. yyyy
% 7) - Day
% 8) - Month
% 9) - Year
\newcommand{\createPerson}[9]
{
\begin{tabularx}{\textwidth}{lXRc}%
Navn: & \nameref{#1} & \formatdate{#4}{#5}{#6} & $\star$\\%
\ifNoArgumentElse{#2}{Kaldenavn: & #3}{Fødenavn: & #2} & \ifNoArgumentElse{#7#8#9}{&}{%
\ifNoArgumentElse{#7}{%
\ifNoArgumentElse{#8}{#9}{\monthYearDate\formatdate{1}{#8}{#9}}%
}{\formatdate{#7}{#8}{#9}} & \cross%
}%
\ifNoArgumentElse{#2}{}{\\Kaldenavn: & #3 &&}%
\end{tabularx}%
}
%Arguments
% 1) The argument to test
% 2) If empty then do this
% 3) If not empty then do this
\newcommand{\ifNoArgumentElse}[3]{
\ifthenelse{\isempty{#1}}{#2}{#3}%
}
\newcommand{\cross}[1][1pt]{\ooalign{%
\rule[1ex]{1ex}{#1}\cr% Horizontal bar
\hss\rule{#1}{.7em}\hss\cr}% Vertical bar
}
\begin{document}
\subsection{Else Jensen}
\label{person1}
\createPerson
{person1}
{Else Nielsen}
{Else}
{11}
{9}
{1940}
{13}
{11}
{1999}
\subsection{Hans Wright}
\label{person2}
\createPerson
{person2}
{}
{Hans}
{11}
{9}
{1940}
{}
{11}
{1999}
\end{document}