8

I need a SWOT analyse in color, and I found this one at http://www.mostlycolor.ch/2013/10/colored-blocks-in-beamer.html :

enter image description here

Can someone help me by converting the beamer, so I can use it in an article? My preamble and document look like this:

\documentclass[a4paper,12pt,oneside]{article}
\usepackage[english]{babel}
\usepackage{tikz}
\usepackage{pgf}
\usetikzlibrary{shapes,arrows,positioning,calc,threeparttable} 
\usepackage{tabu}
\usepackage{hyperref}
\usepackage{longtable}
\usepackage{array}
\usepackage{multirow,tabularx,booktabs}

\newenvironment<>{problock}[1]{

\begin{actionenv}\#2
\def\insertblocktitle{#1}
\par
\mode<presentation>{
\setbeamercolor{block title}{fg=white,bg=green!50!black}
\setbeamercolor{block body}{fg=black,bg=green!10}
\setbeamercolor{itemize item}{fg=red!20!black}
\setbeamertemplate{itemize item}[triangle]
}
\usebeamertemplate{block begin}}
{\par\usebeamertemplate{block end}\end{actionenv}}
\newenvironment<>{conblock}[1]{

\begin{actionenv}#2
\def\insertblocktitle{#1}
\par
\mode<presentation>{
\setbeamercolor{block title}{fg=white,bg=red!50!black}
\setbeamercolor{block body}{fg=black,bg=red!10}
\setbeamercolor{itemize item}{fg=green!20!black}
\setbeamertemplate{itemize item}[triangle]
}
\usebeamertemplate{block begin}}
{\par\usebeamertemplate{block end}\end{actionenv}}

\begin{document}

\section{SWOT}
\begin{frame}{SWOT Matrix}
\begin{columns}[t]
\begin{column}{.5\textwidth}
\begin{problock}{\textsc{strengths}}
\begin{itemize}
\item Business
\begin{itemize}
\item revenue: \$10 B
\item market share: 70\%
\end{itemize}
\item Product
\begin{itemize}
\item 32-bit color
\item written in OpenCL
\end{itemize}
\end{itemize}
\end{conblock}
\end{column}
\begin{column}{.5\textwidth}
\begin{conblock}{\textsc{weaknesses}}
\begin{itemize}
\item Business
\begin{itemize}
\item very expensive
\item gold plating issues
\end{itemize}
\item Product
\begin{itemize}
\item requires at least 128 cores
\item no gamut mapping
\end{itemize}
\end{itemize}
\end{problock}
\end{column}
\end{columns}
\begin{columns}[t]
\begin{column}{.5\textwidth}
\begin{problock}{\textsc{opportunities}}
\begin{itemize}
\item Business
\begin{itemize}
\item everybody wants color
\item clouds love rainbows
\end{itemize}
\item Product
\begin{itemize}
\item cameras deliver 14 bits per pixel
\item big data is pervasive
\end{itemize}
\end{itemize}
\end{conblock}
\end{column}
\begin{column}{.5\textwidth}
\begin{conblock}{\textsc{threats}}
\begin{itemize}
\item Business
\begin{itemize}
\item pursue low hanging fruit
\item people do not care about color quality
\end{itemize}
\item Product
\begin{itemize}
\item competitors use CIELAB
\item spectral is a new trend
\end{itemize}
\end{itemize}
\end{problock}
\end{column}
\end{columns}
\end{frame}

\end{document}
  • the <> and \usebeamertemplate syntax is all beamer-specific but you are using article – David Carlisle May 14 '14 at 13:45
  • The code you found will only work in the beamer document class, which is designed for presentations. So you can't just paste it into an article class document. – Alan Munn May 14 '14 at 13:46
  • Ah, I see. Is there a way to convert it into an article? – A. F. May 14 '14 at 13:49
  • 2
    Something like this SWOT Matrix using TikZ? You'll need to add some colors ... – Ignasi May 14 '14 at 14:10
  • Yes, and the background letter "S, W, O,T". I have tried, but it won't work. – A. F. May 14 '14 at 14:12
10

Change font, text and colors according your needs.

This code was adapted from my answer to SWOT Matrix using TikZ

\documentclass[10pt,tikz,border=2mm]{standalone}
\usepackage{times}

\usepackage{tikz}
\usetikzlibrary{matrix}

\colorlet{helpful}{lime!70}
\colorlet{harmful}{red!30}
\colorlet{internal}{yellow!20}
\colorlet{external}{cyan!30}
\colorlet{S}{helpful!50!internal}
\colorlet{W}{harmful!50!internal}
\colorlet{O}{helpful!50!external}
\colorlet{T}{harmful!50!external}

\newcommand{\texta}{Helpful\\ \tiny (to achieve the objective)\par}
\newcommand{\textb}{Harmful\\ \tiny (to achieve the objective)\par}
\newcommand{\textcn}{Internal origin\\ \tiny (product\slash company attributes)\par}
\newcommand{\textdn}{External origin\\ \tiny (environment\slash market attributes)\par}

\newcommand{\back}[1]{\fontsize{60}{70}\selectfont #1}

\begin{document}
\begin{tikzpicture}[
    any/.style={minimum width=3cm,minimum height=3cm,%
                 text width=2.5cm,align=center,outer sep=0pt},
    header/.style={any,minimum height=1cm,fill=black!10},
    leftcol/.style={header,rotate=90},
    mycolor/.style={fill=#1, text=#1!60!black}
]

\matrix (SWOT) [matrix of nodes,nodes={any,anchor=center},%
                column sep=-\pgflinewidth,%
                row sep=-\pgflinewidth,%
                row 1/.style={nodes=header},%
                column 1/.style={nodes=leftcol},
                inner sep=0pt]
{
          &|[fill=helpful]| {\texta} & |[fill=harmful]| {\textb} \\
|[fill=internal]| {\textcn} & |[mycolor=S]| \back{S} & |[mycolor=W]| \back{W} \\
|[fill=external]| {\textdn} & |[mycolor=O]| \back{O} & |[mycolor=T]| \back{T} \\
};

\node[any, anchor=center] at (SWOT-2-2) {strength 1\\ strength 2};
\node[any, anchor=center] at (SWOT-2-3) {weakness 1\\ weakness 2};
\node[any, anchor=center] at (SWOT-3-2) {opportunity 1\\ opportunity 2};
\node[any, anchor=center] at (SWOT-3-3) {threat 1\\ threat 2};

\end{tikzpicture}
\end{document}

enter image description here

6

With a table:

\documentclass[10pt,table]{article}
\usepackage{times}

\usepackage{array}
\usepackage{graphicx}
\usepackage{tikz}

\colorlet{helpful}{lime!70}
\colorlet{harmful}{red!30}
\colorlet{internal}{yellow!20}
\colorlet{external}{cyan!30}
\colorlet{S}{helpful!50!internal}
\colorlet{W}{harmful!50!internal}
\colorlet{O}{helpful!50!external}
\colorlet{T}{harmful!50!external}

\newcommand{\texta}{Helpful\par \tiny (to achieve the objective)}
\newcommand{\textb}{Harmful\par \tiny (to achieve the objective)}
\newcommand{\textcn}{\rotatebox[origin=c]{90}{\parbox[t]{3cm}{\centering Internal origin\\ \tiny (product\slash company attributes)\par}}}
\newcommand{\textdn}{\rotatebox[origin=c]{90}{\parbox[b]{3cm}{\centering External origin\\ \tiny (environment\slash market attributes)\par}}}

\newcommand{\texts}{\makebox[0pt][c]{\parbox[t]{0.2\textwidth}{\centering strength 1\par strength 2}}}
\newcommand{\textw}{\makebox[0pt][c]{\parbox[t]{0.2\textwidth}{\centering weakness 1\par weakness 2}}}
\newcommand{\texto}{\makebox[0pt][c]{\parbox[t]{0.2\textwidth}{\centering opportunity 1\par opportunity 2}}}
\newcommand{\textt}{\makebox[0pt][c]{\parbox[t]{0.2\textwidth}{\centering threat 1\par threat 2}}}


\newcommand{\back}[1]{\tikz\node[overlay,text=#1!60!black,font=\fontsize{60}{70}\selectfont](char) at (0,-0.1) {#1};}
\newcommand\mycolor[1]{\cellcolor{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}

\begin{document}
\begin{tabular}{c*{2}{C{0.2\textwidth}}}
                            &\cellcolor{helpful} \texta  & \cellcolor{harmful} \textb \\
\cellcolor{internal}\textcn & \mycolor{S}\back{S} \texts & \mycolor{W}\back{W} \textw \\
\cellcolor{external}\textdn & \mycolor{O}\back{O} \texto & \mycolor{T}\back{T} \textt
\end{tabular}

\end{document}

enter image description here

1

My previous answer needs to know size of largest box to fix the correct minimum height. Harish Kumar offers an alternative solution based in tabular which solves the problem with paragraph dimensions.

Here I offer another solution based in tcbraster (from tcolorbox). It uses raster equal height=rows option to automatically adjust (two compilations) all boxes in same row to its correct size. It also uses watermark text option to draw background marks. And although it has not been used in this case, fitting tcolorbox library could adjust inner text to fit into its corresponding rectangle.

\documentclass[10pt]{article}
\usepackage{times}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}

\colorlet{helpful}{lime!70}
\colorlet{harmful}{red!30}
\colorlet{internal}{yellow!20}
\colorlet{external}{cyan!30}
\colorlet{S}{helpful!50!internal}
\colorlet{W}{harmful!50!internal}
\colorlet{O}{helpful!50!external}
\colorlet{T}{harmful!50!external}

\newcommand{\texta}{Helpful\par \tiny (to achieve the objective)}
\newcommand{\textb}{Harmful\par \tiny (to achieve the objective)}
\newcommand{\textcn}{\rotatebox[origin=c]{90}{\parbox[t]{3cm}{\centering Internal origin\\ \tiny (product\slash company attributes)\par}}}
\newcommand{\textdn}{\rotatebox[origin=c]{90}{\parbox[b]{3cm}{\centering External origin\\ \tiny (environment\slash market attributes)\par}}}

\newcommand{\texts}{strength 1\par strength 2}
\newcommand{\textw}{weakness 1\par weakness 2}
\newcommand{\texto}{opportunity 1\par opportunity 2}
\newcommand{\textt}{threat 1\par threat 2}

\tcbset{swotbox/.style={size=normal, boxrule=0pt,
            colback=#1, watermark text=#1, width=.5\linewidth-5mm},
        header/.style={size=small, boxrule=0pt, width=.5\linewidth-5mm, colback=#1, valign=center, halign=center},
        firstcol/.style={header=#1, width=1cm}
        }


\begin{document}

\begin{tcbitemize}[raster columns=3, raster rows=3, enhanced, sharp corners, raster equal height=rows, raster force size=false, raster column skip=0pt, raster row skip = 0pt]

%Empty corner and two headers
\tcbitem[blankest, width=1cm]
\tcbitem[header = helpful]
\texta
\tcbitem[header = harmful]
\textb

%First row
\tcbitem[firstcol = internal]
\textcn
\tcbitem[swotbox = S]
\lipsum[2]
\tcbitem[swotbox = W]
\lipsum[2]

%Second row
\tcbitem[firstcol = external]
\textcn
\tcbitem[swotbox=O]
\lipsum[2]
\tcbitem[swotbox=T]
\lipsum[2]
\end{tcbitemize}

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