3
\documentclass[11pt, oneside]{article}
\usepackage{geometry}
\geometry{a4paper}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{arydshln}
\usepackage[table]{xcolor}
\usepackage{pifont}

\begin{document}

\begin{center} \renewcommand*\arraystretch{1.2}

\scalebox{1}[1]{|c|{\begin{tabular}[t]{|rrl||c|c|c|c||c|} \hline\multicolumn{3}|} & {\sc{c1}} & {\sc{c2}} & {\sc{c3}} & {\sc{c4}} & {\textit{H}} \\[0.5ex]

\& & & {\textit{w=7}} & {\textit{w=3}} & {\textit{w=3}} & {\textit{w=1}} & \\

\hline \hline a. & \ding{43} & {O1} & & -3 & & -1 & -4 \\

\hline b. & & {O2} & & -3 & -3 & -1 & -7 \\

\hline c. & \ding{43} & {O3} & & & -3 & -1 & -4 \\

\hline \end{tabular} \renewcommand*\arraystretch{1} \end{center}

\end{document}
  • 3
    You never closed the \scalebox{.}[.]{... construction. Also, the initial |c| contained in the \scalebox argument seems out-of-place. – Werner Jan 18 at 22:24
  • You have also enclosed {\begin{tabular}[t]{|rrl||c|c|c|c||c|} \hline\multicolumn{3}|} in braces. – Simon Jan 18 at 22:30
  • ...this is how I figured it out: Copied your code; added a closing brace at the end of the document; my IDE (TeXnicCentre) highlights matching braces... – Werner Jan 18 at 22:35
4

I suggest to simplify your syntax quite a bit:

  • instead of the center environment, which adds additional vertical spaces, you could use \centering

  • the \scalebox{1}{1}{...} does not have any effect (scales both directions by 1), thus can be left out

  • your second row has not enough entries, I suspect one empty cell is missing at the start

  • two-letter font commands are deprecated, see Does it matter if I use \textit or \it, \bfseries or \bf, etc (and just my personal opinion, the combination between small caps and numbers looks odd...)

  • for better spacing put your equations w=3 in math mode instead of italics, same for all the negative numbers. This will give you real minus signs instead of hyphens

  • many of the {} around the cells are unnecessary (thank to @Au101 for pointing this out in the comments)

  • and what Werner and Simon say in their comments below your question

and please have a look at http://betterposters.blogspot.com/2012/08/the-data-prison.html

\documentclass[11pt, oneside]{article}
\usepackage{geometry}
\geometry{a4paper}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{arydshln}
\usepackage[table]{xcolor}
\usepackage{pifont}

\begin{document}

\begingroup
\centering
\renewcommand*\arraystretch{1.2}
\begin{tabular}[t]{|rrl||c|c|c|c||c|} 
    \hline
    \multicolumn{3}{|l}{} & \textsc{c1} & \textsc{c2} & \textsc{c3} & \textsc{c4} & \textit{H} \\[0.5ex]
    \& & & & $w=7$ & $w=3$ & $w=3$ & $w=1$ &\\
    \hline \hline 
    a. & \ding{43} & O1 & & $-3$ & & $-1$ & $-4$ \\
    \hline 
    b. & & O2 & & $-3$ & $-3$ & $-1$ & $-7$ \\
    \hline 
    c. & \ding{43} & O3 & & & $-3$ & $-1$ & $-4$ \\
    \hline 
\end{tabular}

\endgroup


\end{document}

enter image description here

  • Having corrected {\sc{c1}} to {\textsc{c1}} surely you don't need the braces wrapped around \textsc{c1}? Although, actually they wouldn't have had any effect in the first place i don't believe – Au101 Jan 18 at 22:46
  • @Au101 At least these braces don't hurt. They could be useful if one decides to automatically align the cells with siunitx (for this table probably overkill ...) – user36296 Jan 18 at 22:50
  • So just to add a stupid question to a stupid question -- how do I get the left hand double vertical bar to go all the way to the top? – Simon Rake Jan 18 at 22:57
  • and also and of course thank you for your input @samcarter et al – Simon Rake Jan 18 at 22:59
  • @SimonRake Remove \multicolumn{3}{|l}{} and instead write & & to get the double bar until the top – user36296 Jan 18 at 23:04
3

Maybe this is what you want?

\documentclass[11pt, oneside]{article}
\usepackage{geometry}
\geometry{a4paper}
\usepackage{graphicx}
\usepackage{amsmath, amssymb}
\usepackage{hhline}
\usepackage{arydshln}
\usepackage[table]{xcolor}
\usepackage{pifont}

\begin{document}

\[ \renewcommand*\arraystretch{1.2}
\begin{array}
{|rrl||c|c|c|c||c|}
 \hhline{---||----||-}
\textsc{c1} & & & {\textsc{c2}} & {\textsc{c3}} & {\textsc{c4}} & {H} & \\[0.5ex]
\text{\&} & & {w=7} & {w=3} & {w=3} & {w=1} & & \\
\hhline{===::====::=}
a. & \text{\ding{43}} & {O1} & & -3 & & -1 & -4 \\
\hhline{---||----||-} b. & & {O2} & & -3 & -3 & -1 & -7 \\
\hhline{---||----||-}
 c. & \text{\ding{43}} & {O3} & & & -3 & -1 & -4 \\
\hhline{---||----||-}
 \end{array}\]%

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.