我正在为我大学的论文格式编写 LaTeX 课程,该课程要求在标题页上写上签名行。签名行的标签因论文类型而异,因此我使用了参数化的 \maketitle 宏。但是,除 coop 之外的任何操作都会导致论文导师签名行前面出现多余的空格。下面是一个最低限度的失败示例。
\documentclass{report}
\usepackage{etoolbox}
\begin{document}
\newcommand{\siglines}[1][coop]{
\begin{tabular}{@{}l}
\\ \hline
Student \\
\\
\\ \hline
\ifstrequal{#1}{coop}{Employer Thesis Advisor~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}{}
\ifstrequal{#1}{research}{Faculty Thesis Advisor~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}{}
\ifstrequal{#1}{pp}{Company Liaison~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}{}
\ifstrequal{#1}{eship}{Faculty Thesis Advisor~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}{} \\
\\
\\ \hline
\ifstrequal{#1}{coop}{Faculty Thesis Advisor}{}
\ifstrequal{#1}{research}{Committee Member}{}
\ifstrequal{#1}{pp}{Faculty Thesis Advisor}{}
\ifstrequal{#1}{eship}{Committee Member}{} \\
\end{tabular}
}
\siglines[eship]
\end{document}
我该如何抑制这些空间?如果是合作模式,似乎没有空间,而研究、pp 和 eship 模式会增加空间。
另外,关于 tex.sx 的问题:我如何让它呈现 MFE 并将其插入到我的问题中,以便我可以显示它的渲染效果?
答案1
换行符就是空格。空格就是空格。%
如果不需要空格,请使用符号来结束行。
例如:
\documentclass{report}
\usepackage{etoolbox}
\begin{document}
\newcommand{\siglines}[1][coop]{%
\begin{tabular}{@{}l}
\\\hline
Student\\
\\
\\\hline
\ifstrequal{#1}{coop}{Employer Thesis Advisor~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}{}%
\ifstrequal{#1}{research}{Faculty Thesis Advisor~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}{}%
\ifstrequal{#1}{pp}{Company Liaison~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}{}%
\ifstrequal{#1}{eship}{Faculty Thesis Advisor~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}{}\\
\\
\\\hline
\ifstrequal{#1}{coop}{Faculty Thesis Advisor}{}%
\ifstrequal{#1}{research}{Committee Member}{}%
\ifstrequal{#1}{pp}{Faculty Thesis Advisor}{}%
\ifstrequal{#1}{eship}{Committee Member}{}\\
\end{tabular}
}
\siglines[eship]
\end{document}