
列表如下。
\begin{tabular}{|>{\centering\arraybackslash}m{2cm}|>{\centering\arraybackslash}m{7cm}|>{\centering\arraybackslash}m{1cm}|}
\hline
\textbf{Keys} & \textbf{Description} & \textbf{Type}
\end{tabular}
我想以某種方式縮短命令
**{|>{\centering\arraybackslash}m{2cm}|>{\centering\arraybackslash}m{7cm}|>{\centering\arraybackslash}m{1cm}|}**
進入一些短命令,例如**\firststyle**
,所以我不需要一直複製長字串。
\begin{tabular} {\firststyle}
\hline
\textbf{Keys} & \textbf{Description} & \textbf{Type}
\end{tabular}
答案1
使用\newcolumntype
fromarray
包,您可以定義新的列類型,有或沒有參數。請參閱第 1.1 節包文件。
\documentclass{article}
\usepackage{array}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
\newcolumntype{A}{|M{2cm}|M{7cm}|M{1cm}|}
\begin{document}
You can define a column type with a parameter:
\begin{tabular}{|M{2cm}|M{7cm}|M{1cm}|}
\hline
\textbf{Keys} & \textbf{Description} & \textbf{Type}
\end{tabular}
You can even define a unique column type for all the columns of your table:
\documentclass{article}
\usepackage{array}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
\newcolumntype{A}{|M{2cm}|M{7cm}|M{1cm}|}
\begin{document}
You can define a column type with a parameter:
\begin{tabular}{|M{2cm}|M{7cm}|M{1cm}|}
\hline
\textbf{Keys} & \textbf{Description} & \textbf{Type}
\end{tabular}
I don't know how much this is orthodox, but you can even define a unique column type for all the columns of your table:
\begin{tabular}{A}
\hline
\textbf{Keys} & \textbf{Description} & \textbf{Type}
\end{tabular}
\end{document}