2

I'm looking for a way to draw the grid for a "logic grid puzzle". There is a package called "logic puzzle" but that doesn't seem to include this type of logic puzzle.

Any idea(s)?

  • 2
    Looks like 'ordinary' tables? – user31729 May 23 '16 at 22:43
  • I tried asking here, @cfr. – Quinn Culver May 23 '16 at 23:48
  • @QuinnCulver: Linking to this question is ... (fill in yourself) ;-) – user31729 May 24 '16 at 0:05
4

This is a starter only, not perfect yet: A 'weird' combination of \multicolumn and \cline and \multirow will provide a grid structure as needed.

\documentclass{article}

\usepackage{multirow}
\usepackage{tikz}
\usetikzlibrary{shadings}
\usepackage{colortbl}
\usepackage{array}
\usepackage[most]{tcolorbox}
\usepackage{graphicx}

\newcommand{\tikzball}[1][]{%
\begin{tikzpicture}%
\shade[ball color=blue,#1] (0,-0.1) circle (0.2);
\end{tikzpicture}%
}

\newlength{\logpuzzlecellwidth}
\setlength{\logpuzzlecellwidth}{0.5cm}

\newcolumntype{A}[1]{>{\centering\arraybackslash}m{#1}}
\begin{document}

\begin{tabular}{|>{\vphantom{\tikzball}}l|l|*{10}{A{\logpuzzlecellwidth}|}}
  \multicolumn{1}{c}{}  & \multicolumn{1}{c}{} & \multicolumn{5}{|>{\columncolor[gray]{0.8}}c|}{owners} & \multicolumn{5}{>{\columncolor[gray]{0.8}}c|}{breeds} \tabularnewline[1ex]
  \cline{3-12}
\multicolumn{1}{c}{} & \multicolumn{1}{c|}{} & \rotatebox{90}{Arara} & \rotatebox{90}{Booktabs} & \rotatebox{90}{Colortable}  & \rotatebox{90}{Datetime} & \rotatebox{90}{etoolbox} & \rotatebox{90}{A} & \rotatebox{90}{B} & \rotatebox{90}{C}  & \rotatebox{90}{D} & \rotatebox{90}{E}  \tabularnewline
\hline
\multirow{6}{*}{\rotatebox{90}{cats}}  & A & & & & & & & & & & \tabularnewline
  \cline{2-12}
  & B & & & & & & & & & & \tabularnewline  
  \cline{2-12}
  & C & & & & & & & & & & \tabularnewline
  \cline{2-12}
  & D & & & & & & & & & & \tabularnewline
  \cline{2-12}
  & E & & \tikzball & & & & & & & & \tabularnewline
\hline
\multirow{6}{*}{\rotatebox{90}{dogs}}  & A & & & & & & \multicolumn{5}{c}{} \tabularnewline
  \cline{2-7}
  & B & & & & & & \multicolumn{5}{c}{} \tabularnewline
  \cline{2-7}
  & C & & & & & \tikzball[ball color=red] & \multicolumn{5}{c}{} \tabularnewline
  \cline{2-7}
  & D & & & & & & \multicolumn{5}{c}{} \tabularnewline
  \cline{2-7}
  & E & & & & & & \multicolumn{5}{c}{} \tabularnewline
  \cline{1-7}
\end{tabular}

\end{document}

enter image description here

  • I think it'd look better if the cells were squares, though. – Alenanno May 23 '16 at 23:31
  • @Alenanno: yes, definitely. I will provide a better solution (later on) – user31729 May 23 '16 at 23:31

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.