Tuesday, July 7, 2015

SWOT matrices in LaTeX

In marketing SWOT matrices are the bread and butter, especially in presentations and in market requirement documents. A SWOT matrix is a structured planning method used to evaluate the strengths, weaknesses, opportunities and threats involved in a product or feature. in an 18 October 2013 post I illustrated how colored blocks can be used to set SWOT matrices into type for Beamer.

TeX Live 2015 contains version 3.61 of the tcolorbox package by Thomas Sturm, which provides an environment for producing colored and frame text boxes with fine control of typesetting: the manual is 405 pages long! This provides an alternative method to set into type SWOT matrices.

In the document preamble we add

\usepackage[table]{xcolor}
\definecolor{swotS}{RGB}{226,237,143}
\definecolor{swotW}{RGB}{247,193,139}
\definecolor{swotO}{RGB}{173,208,187}
\definecolor{swotT}{RGB}{192,165,184}
\usepackage[raster]{tcolorbox}

With this, the template for a SWOT matrix is as follows:


\begin{tcbraster}[raster columns=2, boxrule=0mm, arc=0mm]
\begin{tcolorbox}[equal height group=A, size=fbox, colback=swotS!60, colframe=swotS!80!black, title=\textsc{strengths}]
\begin{enumerate}
\item business 1
\item business 2
\item business 3
\end{enumerate}
\tcblower
\begin{enumerate}
\item product 1
\item product 2
\item product 3
\end{enumerate}
\end{tcolorbox}
\begin{tcolorbox}[equal height group=A, size=fbox, colback=swotW!60, colframe=swotW!80!black, title=\textsc{weaknesses}]
\begin{enumerate}
\item business 1
\item business 2
\item business 3
\end{enumerate}
\tcblower
\begin{enumerate}
\item product 1
\item product 2
\item product 3
\end{enumerate}
\end{tcolorbox}
\begin{tcolorbox}[equal height group=B, size=fbox, colback=swotO!60, colframe=swotO!80!black, title=\textsc{opportunities}]
\begin{enumerate}
\item business 1
\item business 2
\item business 3
\end{enumerate}
\tcblower
\begin{enumerate}
\item product 1
\item product 2
\item product 3
\end{enumerate}
\end{tcolorbox}
\begin{tcolorbox}[equal height group=B, size=fbox, colback=swotT!60, colframe=swotT!80!black, title=\textsc{threats}]
\begin{enumerate}
\item business 1
\item business 2
\item business 3
\end{enumerate}
\tcblower
\begin{enumerate}
\item product 1
\item product 2
\item product 3
\end{enumerate}
\end{tcolorbox}
\end{tcbraster}

If you keep your data in a database, you can write a simple SQL program that can generate a market requirement document using this template and some boilerplate copy. The typeset result looks as follows.

A SWOT matrix set into type with the LaTeX tcolorbox environment

If this it too garish, you can always use a table environment and the following template:

\begin{table}[htbp]
\centering
%\topcaption{Table captions are better up top} % requires the topcapt package
\begin{tabular}{@{} p{0.10\textwidth} p{0.45\textwidth} | p{0.45\textwidth} @{}} % Column formatting, @{} suppresses leading/trailing space
\toprule
& \cellcolor{swotS!50}{\textbf{strenghts}} & \cellcolor{swotW!50}\textbf{weaknesses}\\
\midrule
\multirow{3}{*}{\textbf{business}} & SB1 & WB1 \\\cline{2-3}
& SB2 & WB2 \\\cline{2-3}
& SB3 & WB3 \\
\midrule
\multirow{3}{*}{\textbf{product}} & SP1 & WP1 \\\cline{2-3}
& SP2 & WP2 \\\cline{2-3}
& SP3 & WP3 \\
\toprule
& \cellcolor{swotO!50}\textbf{opportunities} & \cellcolor{swotT!50}\textbf{threats}\\
\midrule
\multirow{3}{*}{\textbf{business}} & OB1 & TB1 \\\cline{2-3}
& OB2 & TB2 \\\cline{2-3}
& OB3 & TB3 \\
\midrule
\multirow{3}{*}{\textbf{product}} & OP1 & TP1 \\\cline{2-3}
& OP2 & TP2 \\\cline{2-3}
& OP3 & TP3 \\
\bottomrule
\end{tabular}
\caption[SWOT template]{SWOT matrix caption.}
\label{tab:swot}
\end{table}

For the following look:

A SWOT matrix set into type with the LaTeX tabular environment

No comments:

Post a Comment