\scalebox 不工作

\scalebox 不工作

我不明白为什么 scalebox 不起作用。这是工作示例(取消注释 \scalebox 行,文件无法编译。(我在格式化长行时遇到了麻烦)。

\documentclass[11pt]{scrartcl}
\usepackage{graphics}
\usepackage{tabularx}
\begin{document}
\begin{tabularx}{\textwidth}{Xllll}
%\scalebox{.50}
\hline
Type of Violation & 1st & 2nd & 3rd & 4th \\
\hline
\begin{tabular}[c]{@{}l@{}}
Presence without \\
justification, during\\ work hours\\
in an unauthorized\\place\end{tabular} & 10\% & 25\% & 50\% & 1 day \\    
\hline
Receiving non-work    & \begin{tabular}[c]{@{}l@{}}Written\\     Warning\end{tabular} & 10\%   & 15\%    & 25\%      \\
\hline
Personal use      & \begin{tabular}[c]{@{}l@{}}Written\\ 
Warning\end{tabular} & 10\%   & 25\%    & 50\%      \\
\hline
Interference   & 50\%      & 1 day  & 2 days   & 3 days    \\
\hline
Entry/Exit    & \begin{tabular}[c]{@{}l@{}}Written\\ 
Warning\end{tabular} & 10\%   & 15\%    & 25\%      \\

\end{tabularx}



\end{document}  

**这个问题是关于缩放/缩小整个表的大小。答案在'\tabular' 环境后的缩进处理表格的缩进。这不是我的问题。

答案1

您可以使用 来缩放整个表格,\scalebox{0.5}{<table>}而不是\scalebox{0.5}在表格中间使用 。但是,这不会带来任何好处,因为表格将缩放到线宽的一半。

这似乎是一份工作tabulary,带有 David 会欣赏的补丁。

\documentclass[11pt]{scrartcl}
\usepackage{tabulary,array}
\usepackage{xpatch}

\newcommand{\writtenwarning}{%
  \begin{tabular}{@{}l@{}}
  Written \\ Warning
  \end{tabular}%
}

\makeatletter
\xpatchcmd{\TY@box@v}{\vtop}{$\m@th\vcenter}{}{}
\xapptocmd{\TY@box@v}{$}{}{}
\makeatother

\begin{document}

\noindent
\begin{tabulary}{\textwidth}{>{\strut}Lllll}
\hline
Type of Violation & 1st & 2nd & 3rd & 4th \\
\hline
Presence without justification, during work hours
in an unauthorized place & 10\% & 25\% & 50\% & 1 day \\    
\hline
Receiving non-work & \writtenwarning & 10\% & 15\% & 25\% \\
\hline
Personal use & \writtenwarning & 10\%   & 25\%    & 50\% \\
\hline
Interference & 50\% & 1 day  & 2 days   & 3 days \\
\hline
Entry/Exit    & \writtenwarning & 10\%   & 15\%    & 25\% \\
\hline
\end{tabulary}

\end{document}  

在此处输入图片描述

相关内容