# \scalebox not working

I can't figure out why scalebox isn't working. Here's the working example (uncomment the \scalebox line and the file doesn't compile. (I had trouble formatting the long lines).

\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}


**This question is about scaling/reducing an entire table in size. The answer at Indentation after '\tabular' environments deals with INDENTING a table. This is NOT my issue.

• It does not work, as the syntax is wrong, it should be \scalebox{0.5}{text} to scale the text. However, please don't scale a table. If you want it to be smaller use \begin{tabularx}{.75\textwidth}{Xllll} or similar. If you want a smaller fontsize, set it manually. – samcarter_is_at_topanswers.xyz Nov 8 '17 at 15:03
• If you uncomment the command then you have \scalebox{.50}{\hline} but \hline can not work inside a box of any sort. – David Carlisle Nov 8 '17 at 15:10
• I am trying to shrink the entire table. – user26732 Nov 8 '17 at 15:13
• @sam carter: Neither of these solutions works. The first throws the following error: imgur.com/a/zgceW The second kind of works, but at .75 there is overwritten text. How can I scale the entire image so that it fits on the page? – user26732 Nov 8 '17 at 15:22
• If \noindent before your table solves your problem. That means: \noindent \begin{tabularx}{\textwidth}{Xllll}. It's a duplicat to Indentation after '\tabular' environments. - Always helpful is \usepackage{showframe}-> it draws a page-layout diagram. – Bobyandbob Nov 8 '17 at 15:37

You can scale a whole table, by using \scalebox{0.5}{<table>}, not with \scalebox{0.5} in the middle of it. However, this wouldn't do anything nice, because the table would be scaled to half the linewidth.

This seems a job for tabulary, with a patch that David will appreciate.

\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}


• Your example compiles on its own, but then I get a: Runaway argument? \par \par \par \par \cleardoublepage \chapter {Annex No. 6---Model E\ET ! File ended while scanning use of TY@get@body. <inserted text> \par ? " error. I tried ending the document after the table and the error is there, before the table and the file compiles. So the error is somewhere in the table but I can't see it. – user26732 Nov 12 '17 at 10:24
• @user26732 That's because of some syntax error, I guess. – egreg Nov 12 '17 at 10:26
• When I click on "Go to Error" nothing happens. Been at this for over an hour. Any ideas? The file is incomplete so it won't write to log. – user26732 Nov 12 '17 at 10:27
• @user26732 No, but you seem to have a macro badly defined somewhere. – egreg Nov 12 '17 at 10:31
• This won't compile; the only macro is the one you suggested. Is there a syntax error there? Did I copy it incorrectly? I can't paste the shortened file here in a comments box; so here's the image: imgur.com/a/aAcAS – user26732 Nov 12 '17 at 10:40