如何将长句子的文本换入表格副标题中?

如何将长句子的文本换入表格副标题中?

我正在努力让表格的副标题适合表格的指定边距。当句子不太长时,一切都很有效,格式也很好。欢迎提出任何建议。请注意,我无法以任何方式更改标题内容。

代码:

%*** The Summary table **********************************************
\begin{tabularx}{1\linewidth}{|X|}
 \hline%=============================================================
 \SumHead{Title of the project}\\
 \hline%=============================================================
    Development of a Hybrid Brushless Exciter for the Field Supply of a Grid-Connected Wound-Rotor Wind Generator.\\
 \hline%=============================================================
 \SumHead{Objectives}\\
 \hline%=============================================================
    To conduct an analysis by means of basic analytical analysis and Ansys Maxwell finite element analysis. Additionally, to design the windings of a partly constructed brushless hybrid exciter, and to construct and test the design. Finally, to ensure that there is an improvement upon the current design.\\
 \hline%=============================================================
 \SumHead{What is current practice and what are its limitations?}\\
 \hline%=============================================================
   \\

 \hline%=============================================================
 \SumHead{What is new in this project?}\\
 \hline%=============================================================
    \\
 \hline%=============================================================
 \SumHead{If the project is successful, how will it make a difference?}\\
 \hline%=============================================================
     \\

 \hline%=============================================================
 \SumHead{What are the risks to the project being a success? Why is it expected to be successful?}\\
 \hline%=============================================================
    \\

 \hline%=============================================================
 \SumHead{What contributions have/will other students made/make?}\\
 \hline%=============================================================
    %N/A.\\

 \hline%=============================================================
 \SumHead{Which aspects of the project will carry on after completion and why?}\\
 \hline%=============================================================
    \\

 \hline%=============================================================
 \SumHead{What arrangements have been/will be made to expedite
    continuation?}\\
 \hline%=============================================================
    \\
 \hline%=============================================================

\end{tabularx}

表格预览

我注意到我忘记包含 \SumHead 定义,附件如下: \SumHead 定义

答案1

虽然我认为\usepackage[table]{xcolor}在序言中执行并(重新)定义\SumHead

\newcommand\SumHead[1]{\multicolumn{1}{%
   |>{\cellcolor{lightgray!33}\centering\arraybackslash\bfseries}X|}{#1}}

可以满足您的格式要求,我建议您重新考虑表格的整个设计。具体来说,删除所有垂直线和大多数水平线,并得到如下结果:

在此处输入图片描述

\documentclass{article}
\usepackage{tabularx}
\usepackage{booktabs} % for \toprule, \midrule, \bottomrule, and \addlinespace macros
\newcolumntype{Y}{>{\bfseries\raggedright\arraybackslash}X}
\providecommand\SumHead[1]{\multicolumn{1}{@{}Y@{}}{#1}}
\begin{document}

\noindent
\begin{tabularx}{1\linewidth}{@{}X@{}}
 \toprule
 \SumHead{Title of the project}\\
 \addlinespace
 Development of a Hybrid Brushless Exciter for the Field Supply of a Grid-Connected Wound-Rotor Wind Generator.\\
 \midrule
 \SumHead{Objectives}\\
 To conduct an analysis by means of basic analytical analysis and Ansys Maxwell finite element analysis. Additionally, to design the windings of a partly constructed brushless hybrid exciter, and to construct and test the design. Finally, to ensure that there is an improvement upon the current design.\\
 \addlinespace
 \SumHead{What is current practice and what are its limitations?}\\
 \dots \\
 \addlinespace
 \SumHead{What is new in this project?}\\
 \dots  \\
 \addlinespace
 \SumHead{If the project is successful, how will it make a difference?}\\
 \dots \\
 \addlinespace
 \SumHead{What are the risks to the project being a success? Why is it expected to be successful?}\\
 \dots \\
 \addlinespace
 \SumHead{What contributions have\slash will other students made\slash make?}\\
 \dots \\
 \addlinespace
 \SumHead{Which aspects of the project will carry on after completion and why?}\\
 \dots \\
 \addlinespace
 \SumHead{What arrangements have been\slash will be made to expedite
    continuation?}\\
 \dots \\
 \bottomrule
\end{tabularx}

\end{document}

相关内容