基于 SWOT 矩阵的 SWOT 战略

基于 SWOT 矩阵的 SWOT 战略

我发现这篇文章有一个很棒的解决方案,可以使用表格来创建 SWOT 分析:SWOT 表 - 如何转换为文章?

这是我使用的另一篇文章中的代码片段:

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

得出下表: SWOT矩阵

现在我尝试调整代码以显示 SWOT 策略。我想将包含大字母“S”、“W”、“O”和“T”的内部四个单元格及其文本移到边缘(替换外部来源、内部来源、有益和有害),以创建空间来列出策略作为先前确定的属性的解决方案。

脚手架看起来像这样……:

战略

...但我想保留 SWOT 矩阵的背景颜色。

我试图调整代码来实现这个目标,但是单元格却萎缩了……

如果有人能告诉我如何实现这一点我将非常感激!

答案1

另一个解决方案是tcolorboxraster。每个元素都是一个,tcolorbox具有容纳任何类型内容的能力,并且所有元素都排列在一个tcbraster元素内。

注意:此解决方案使用blankest在中定义的样式tcolorbox 3.90 2016-02-29. 旧版本将会失败。

\documentclass[border=2mm]{standalone}
\usepackage[most]{tcolorbox}
\usepackage{enumitem}

\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}
\colorlet{SO}{S!50!O}
\colorlet{WO}{W!50!O}
\colorlet{ST}{S!50!T}
\colorlet{WT}{W!50!T}

\tcbset{
    mybox/.style 2 args={%
        enhanced,
%       blankest,
        sharp corners, notitle,
        before skip=6pt, after skip=6pt,
        watermark text=#1, frame hidden,
        colback=#2,
    },
    mybox/.default={mybox={A}{white}},
}

\newenvironment{myitemize}{%
    \begin{itemize}[leftmargin=0pt]}%
    {\end{itemize}}

\begin{document}
\begin{tcbraster}[raster columns=3, raster equal height, raster column skip=0mm, raster row skip=0mm, 
]
\begin{tcolorbox}[blankest]\end{tcolorbox}
\begin{tcolorbox}[mybox={S}{helpful!50!internal}]
\begin{myitemize}
\item A
\item B
\item C
\end{myitemize}
\end{tcolorbox}
\begin{tcolorbox}[mybox={W}{harmful!50!internal}]
\begin{myitemize}
\item A
\item B
\item C
\end{myitemize}
\end{tcolorbox}
\begin{tcolorbox}[mybox={O}{helpful!50!external}]
\begin{myitemize}
\item A
\item B
\item C
\end{myitemize}
\end{tcolorbox}
\begin{tcolorbox}[mybox={}{SO}]
\begin{myitemize}
\item A
\item B
\item C
\item D
\end{myitemize}
\end{tcolorbox}
\begin{tcolorbox}[mybox={}{WO}]
\begin{myitemize}
\item A
\item B
\end{myitemize}
\end{tcolorbox}
\begin{tcolorbox}[mybox={T}{harmful!50!external}]
\begin{myitemize}
\item A
\end{myitemize}
\end{tcolorbox}
\begin{tcolorbox}[mybox={}{ST}]
\begin{myitemize}
\item A
\item B
\end{myitemize}
\end{tcolorbox}
\begin{tcolorbox}[mybox={}{WT}]
\begin{myitemize}
\item A
\item B
\item CCCCCCCCCC
\end{myitemize}
\end{tcolorbox}
\end{tcbraster}
\end{document}

在此处输入图片描述

更新:

tcbraster可以使用tcbitemize不太冗长的来代替。我更改了颜色,使其与 OP 的模型相似。

\documentclass[border=2mm]{standalone}
\usepackage[most]{tcolorbox}
\usepackage{enumitem}

\tcbset{
    mybox/.style 2 args={%
        enhanced,
        sharp corners, notitle,
        before skip=6pt, after skip=6pt,
        watermark text=#1, colframe=blue!70!black,
        colback=#2,
    },
    Sbox/.style={mybox={S}{blue!20}},
    Wbox/.style={mybox={W}{blue!20}},
    Tbox/.style={mybox={T}{blue!20}},
    Obox/.style={mybox={O}{blue!20}},
    Xbox/.style={mybox={}{white}},
}

\newenvironment{myitemize}{%
    \begin{itemize}[leftmargin=0pt]}%
    {\end{itemize}}

\begin{document}
\begin{tcbitemize}[raster columns=3, raster equal height, raster column skip=-.5mm, raster row skip=-.5mm, Xbox
]
\tcbitem[blankest]
\tcbitem[Sbox]
\begin{myitemize}
\item First item
\item Another item
\item One more item
\end{myitemize}
\tcbitem[Wbox]
\begin{myitemize}
\item A very long item which uses more than one line
\end{myitemize}
\tcbitem[Obox]
\begin{myitemize}
\item First item
\item Another item
\end{myitemize}
\tcbitem
\begin{myitemize}
\item Even if a row only contains a line, all boxes
have similar size
\end{myitemize}
\tcbitem
\begin{myitemize}
\item Only one item
\end{myitemize}
\tcbitem[Tbox]
\begin{myitemize}
\item One item
\end{myitemize}
\tcbitem
\begin{myitemize}
\item One item
\end{myitemize}
\tcbitem
\begin{myitemize}
\item One item
\end{myitemize}
\end{tcbitemize}
\end{document}

在此处输入图片描述

答案2

有两个问题:

  1. 表格序言需要更改为

     \begin{tabular}{*{3}{C{0.2\textwidth}}}
    

    为您提供三列类型C

  2. 您需要添加一些适当的垂直间距,例如通过不可见的规则

    \vrule height 35pt depth 35pt width 0pt
    

    在下面的代码中,我将其打包成一个命令\mystrut。如果新单元格很大,则可能需要调整尺寸。

这是包含您的原始代码和第二个表的代码的示例。

示例输出

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

\newcommand{\mystrut}{\vrule height 35pt depth 35pt width 0pt}
\newcommand{\textos}{\makebox[0pt][c]{\parbox[t]{0.2\textwidth}{\centering
text os 1\par text os 2}}}
\newcommand{\textow}{\makebox[0pt][c]{\parbox[t]{0.2\textwidth}{\centering
text ow 1\par text ow 2}}}
\newcommand{\textts}{\makebox[0pt][c]{\parbox[t]{0.2\textwidth}{\centering
text ts 1\par text ts 2}}}
\newcommand{\texttw}{\makebox[0pt][c]{\parbox[t]{0.2\textwidth}{\centering
text tw 1\par text tw 2}}}

\begin{tabular}{*{3}{C{0.2\textwidth}}}
  \mystrut
  & \mycolor{S}\back{S} \texts & \mycolor{W}\back{W} \textw \\
  \mystrut  \mycolor{O}\back{O} \texto & \textos & \textow \\
  \mystrut  \mycolor{T}\back{T} \textt & \textts & \texttw
\end{tabular}

\end{document}

相关内容