我有以下在 MS Word 中创建的表格:
我想在 LaTeX 中按原样重新创建它(保持列标题的相同旋转),并且必须保持垂直线和水平线的原样。
任何使第一列显得“更美观”的“外观”改变也都是好的。
我尝试了以下操作,但似乎不太正确。
\usepackage{tabularx}
\begin{document}
\begin{tabularx}{\textwidth}{| X | c | c | c | c|c|c|c| >{\centering\arraybackslash} c|}
\hline
Description (all named investigators on any proposal or grant/project/fellowship in which a participant is involved, project title, source of support, scheme and round) & \rot{Same Research Area (Yes/No)} & \rot{Support Status (Requested/Current/Past)} & \rot{Proposal/Project ID} & \rot{2013 (\$'000)} & \rot{2014 (\$'000)} & \rot{2015 (\$'000)} & \rot{2016 (\$'000)} & \rot{2017 (\$'000)} \\
\hline
\textbf{Investigators:}
In
\textbf{Project Title:}
Identifying Challenges and
Opportunities in Socially Responsible Investments
\textbf{Funding Body:} ARC
\textbf{Fund Scheme Round:}
DP15
& Yes & Requested & DP150102407 & & & 186 & 196 & 192
\\
\hline
\end{tabularx}
\end{document}
答案1
一种可能的解决方案是使用\rotatebox
fromrotating
包。\newline
用于单元格中的换行符。这里建议将 X 列类型重新定义为 m 类型,而不是默认的 p:
\renewcommand\tabularxcolumn[1]{m{#1}}
并创建两个新的列类型 M 和 C,宽度不同,具有水平和垂直居中:
\newcolumntype{M}{>{\centering\arraybackslash}m{2cm}}
\newcolumntype{C}{>{\centering\arraybackslash}m{0.5cm}}
代码
\documentclass[a4paper]{article}
\usepackage[margin=1cm]{geometry}
\usepackage{rotating,array}
\usepackage{tabularx}
\newcommand\rot[2][90]{%
\rotatebox[origin=c]{#1}{#2}} %#2=90
\renewcommand\tabularxcolumn[1]{m{#1}}
\newcolumntype{M}{>{\centering\arraybackslash}m{2cm}}
\newcolumntype{C}{>{\centering\arraybackslash}m{0.5cm}}
\begin{document}
\begin{tabularx}{\textwidth}{|X|M|M|M|C|C|C|C|C|}
\hline
Description (all named investigators on any proposal or grant/project/fellowship in which a participant is involved, project title, source of support, scheme and round) & \rot{Same Research Area\strut}\rot{(Yes/No)} & \rot{Support Status} \rot{(Requested/Current/Past)} & \rot{Proposal/Project ID} & \rot{2013 (\$'000)} & \rot{2014 (\$'000)} & \rot{2015 (\$'000)} & \rot{2016 (\$'000)} & \rot{2017 (\$'000)} \\
\hline
\textbf{Investigators:}
In \newline
\textbf{Project Title:}
Identifying Challenges and
Opportunities in Socially Responsible Investments\newline
\textbf{Funding Body:} ARC\newline
\textbf{Fund Scheme Round:}\newline
DP15
& Yes & Requested & DP150102407 & & & 186 & 196 & 192 \\ \hline
\end{tabularx}
\end{document}