
Таблица выглядит следующим образом.
\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
from array
вы можете определить новый тип столбца с параметрами или без них. См. раздел 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}