10

See what I'm trying to do here.enter image description here

The MWE I've managed to come up with is as follows:

\documentclass[12pt]{article}
\usepackage{makecell}
\usepackage{cals}
\begin{document}
\begin{tabular}{|p{4cm}|c|p{3.5cm}|}\hline
\diaghead{\theadfont Appeals to agent causality explanation}%
{Preferred type\\of cognitive processing}{Appeals to agent explanation/\\causality}&
\thead{Unrestricted}&\thead{Restricted}\\ \hline
\vspace{1cm}
Reflective & 1. Theology & 2. Science\\ \hline
\vspace{1cm}
Maturationally natural & 3. Popular religion & 4. Commonsense explanations and understandings of the non-social world\\ \hline
\end{tabular}
\end{document}

Which produces this:enter image description here

But the formatting of some rows and columns is all screwy, with some columns centered and others not, some rows centered and others not, and words breaking across lines where they don't need to. Can anyone offer corrections to help me get something closer to the original? Thanks.

7

Here's a solution using TikZ nodes and the positioning library. I'm sure it's possible to do this more elegantly. But, if you're interested in tweaking this just so, this may be a solution that will work for you.

\documentclass[border=4pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,positioning}
\begin{document}

\begin{tikzpicture}[
  node distance=0pt,
  %% h=horizontal, v=vertical   
  %% l=left,  m=middle, r=right,
  %% t=top,   b=bottom,         
  %% w=width, h=height          
  hlw/.style={minimum width=2.5in},
  hmw/.style={minimum width=1.75in},
  hrw/.style={minimum width=2in},
  vth/.style={minimum height=1in},
  vmh/.style={minimum height=1in},
  vbh/.style={minimum height=1.25in},
  %%
  my corner stone/.style={vth,hlw,draw},
  %%
  my text/.style={text width=1.5in},
  my corner stone top/.style={text width=1.5in,align=flush right,anchor=north east},
  my corner stone bot/.style={text width=1.5in,align=flush left,anchor=south west},
  ]
  \node[outer sep=0pt,my corner stone] (corner stone) at (0,0) {};
  \draw (corner stone.north west) -- (corner stone.south east);

  %% top labels
  \node[right =of corner stone,hmw,vth,draw]         (unrestricted square) {Unrestricted};
  \node[right =of unrestricted square,hrw,vth,draw]  (restricted square)   {Restricted};

  %% side labels
  \node[below=of corner stone,hlw,vmh,draw]          (reflective)          {Reflective};
  \node[below=of reflective,hlw,vbh,draw]            (mature)              {Maturationally natural};

  %% contents
  \node[right=of reflective,hmw,vmh,draw]            (theology)            {Theology};
  \node[right=of theology,hrw,vmh,draw]              (science)             {Science};

  \node[right=of mature,hmw,vbh,draw]                (popular)             {Popular religion};
  \node[right=of popular,hrw,vbh,draw,my text]       (long)                {Common sense explanations and understandings of the non-sensical world};

  \node[my corner stone top] at (corner stone.north east) {Appeals to agent explanation/causality};
  \node[my corner stone bot] at (corner stone.south west) {Preferred type of cognitive processing};  


  \foreach \myn [count=\myi] in {theology,science,popular,long}
  {
    \node[anchor=north west] at (\myn.north west) {\myi};
  }
\end{tikzpicture}

\end{document}

enter image description here

7

Well, so why not get rid of that ugly diagonal cell? Try this:

\documentclass{article}
\usepackage{booktabs}
\begin{document}

\begin{table}\centering
\setlength{\tabcolsep}{4mm}
\begin{tabular}{@{}lll@{}}\toprule
 & \multicolumn{2}{c}{Appeals to agent} \\
 & \multicolumn{2}{c}{explanation/causality}\\ \cmidrule(lr){2-3}
Preferred type of &&\\
cognitive processing  & \multicolumn{1}{c}{\textbf{Unrestricted}} & \multicolumn{1}{c}{\textbf{Restricted}} \\ \cmidrule(r){1-1}\cmidrule(l){2-3}
\textbf{Reflective} & 1. Theology & 2. Science\\
\textbf{Maturationally natural} & 3. Popular religion & 4. Commonsense explana-\\ 
&& tions and understandings  \\
&& of the non-social world\\
\bottomrule
\end{tabular}
\end{table}

\end{document}

enter image description here

6

I'd suggest something completely different. It's not perfect, but I think looks nicer. I don't read german, but all comands were stollen from Axel Reichter's Satz von Tabellen.

\documentclass[12pt]{article}
\usepackage{array}
\usepackage{booktabs}
\begin{document}

\newcommand{\armultirow}[3]{%
    \multicolumn{#1}{#2}{%
        \begin{picture}(0,0)%
            \put(0,0){%
            \begin{tabular}[b]{@{}#2@{}}%
            #3%
            \end{tabular}%
        }%
        \end{picture}%
    }%
}%

\newcolumntype{H}[1]{%
    >{\bfseries\centering\hspace{0pt}}m{#1}%
    }

\newcolumntype{L}[1]{%
    >{\bfseries\raggedright\arraybackslash\hspace{0pt}}p{#1}%
    }

\newcolumntype{P}[1]{%
    >{\raggedright\arraybackslash\hspace{0pt}}p{#1}%
    }

\begin{tabular}{P{4cm}P{3.5cm}P{3.5cm}}
\armultirow{1}{L{4cm}}{Preferred type of cognitive processing}
& \multicolumn{2}{H{7.5cm}}{Appeals to agent causality explanation/causality} \\
\cmidrule(lr){2-3}
& \multicolumn{1}{c}{Unrestricted} & \multicolumn{1}{c}{Restricted} \\
\cmidrule(lr){1-1}\cmidrule(lr){2-2}
\cmidrule(lr){3-3}
Refective & 1. Theology & 2. Science\\[1ex]
Maturationally natural & 3. Popular religion & 4. Commonsense explanations and understandings of the non-social world\\
\bottomrule
\end{tabular}
\end{document}

enter image description here

  • +1. Well done. Depending on context, I'd probably recommend to ditch the numbers and add a \toprule as well. – wchargin Apr 15 '15 at 4:46
  • Typos: "refective" (add an l), "causality explanation/causality" (drop "causality," probably). – wchargin Apr 15 '15 at 4:47
4

For middle-aligned paragraph cells, you should use m column and not p one, which is for top-aligned cells.
Then, for horizontal centering, you need to load array package and prepend >{\centering\arraybackslash} to the columns you want to center.

For word-breaking, I think it's because you are limiting the size of columns. Try to increase it or let LaTeX choose.

Finally, don't use \vspaces. Use \setcellgapes and \makegapedcells.

\documentclass[12pt]{article}
\usepackage{array}
\usepackage{makecell}
\usepackage{cals}

\setcellgapes{8pt}
\begin{document}
\begingroup
\makegapedcells
\begin{tabular}{|>{\centering\arraybackslash}m{4cm}|c|>{\centering\arraybackslash}m{3.5cm}|}\hline
\diaghead{\theadfont Appeals to agent causality explanation}%
{Preferred type\\of cognitive processing}{Appeals to agent explanation/\\causality}&
\thead{Unrestricted}&\thead{Restricted}\\ \hline
Reflective & 1. Theology & 2. Science\\ \hline
Maturationally natural & 3. Popular religion & 4. Commonsense explanations and understandings of the non-social world\\ \hline
\end{tabular}
\endgroup
\end{document}
  • 1
    Using \arraystretch has the drawback of cells that are no more vertically centred. It's better to use \setcellgapes and \makegapedcells from makecell. – Bernard Apr 14 '15 at 14:19
  • @Bernard Yes. I'll make an edit. Thanks for pointing it out! – Astrinus Apr 14 '15 at 16:03

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.