我创建了一个自定义命令,如下所示:
\newcommand{\projectSubheading}[3]{
% \vspace{-1pt}
\item
\begin{tabular*}{0.97\textwidth}[t]{l@{\extracolsep{\fill}}r}
\textbf{#1} & #2 \\
\textit{\small#3}
\end{tabular*}
%\vspace{-5pt}
}
我将 3 个字段传递给命令
\projectSubheading
{Multipurpose Unmanned Autonomous Vehicle \href{https://github.com/}{\faGithub}{Arizona, US}
{Relevant Coursework: Artificial Intelligence, Data Structure and Algorithms, System Programming and Operating Systems, Computer Networks, Soft Computing, Digital Signal Processing}
输出内容不适合该页面:
我怎样才能将文本换行到命令中?
答案1
似乎没有必要将内容放在tabular
类似 - 的环境中。相反,下面的定义\projectSubheading
使用\hfill
来扩展前两个参数,并将最后一个参数设置为单独的段落。
\documentclass{article}
\usepackage{hyperref,fontawesome}
\newenvironment{projects}
{\begin{itemize}}
{\end{itemize}}
% \projectSubheading{<project>}{<location>}{<description>}
\newcommand{\projectSubheading}[3]{%
\item
\textbf{#1} \hfill #2 \par
\itshape\small #3
}
\begin{document}
\begin{projects}
\projectSubheading
{Multipurpose Unmanned Autonomous Vehicle \href{https://github.com/}{\faGithub}}% Project
{Arizona, US}% Location
{Relevant Coursework: Artificial Intelligence, Data Structure and Algorithms,
System Programming and Operating Systems, Computer Networks, Soft Computing, Digital Signal Processing}% Description
\end{projects}
\end{document}