![多列多行的 SWOT 矩阵](https://linux22.com/image/349601/%E5%A4%9A%E5%88%97%E5%A4%9A%E8%A1%8C%E7%9A%84%20SWOT%20%E7%9F%A9%E9%98%B5.png)
我在用 LaTeX 创建 SWOT 矩阵时遇到了一个大问题。我尝试过使用表格(多列和多行),也尝试过使用 TikZ,但都失败了。
我需要的是这个:
但应删除文本“SWOT-Analyse”(不在矩阵中),应旋转文本“Externe Analyse”、“Chancen”、“Gefahren”。
我搜索了很多,找到了一些很好的例子,但我没能根据自己的需要修改这些例子。我找到的最接近的例子是这。
\documentclass[12pt,a4paper]{scrartcl}
\usepackage{polyglossia}
\usepackage{fontspec}
\usepackage{times}
\usepackage{tikz}
\usetikzlibrary{matrix, positioning}
\setmainlanguage{german}
\newcommand{\texta}{Stärken\\[-1ex]}
\newcommand{\textb}{Schwächen\\[-1ex]}
\newcommand{\textcn}{Chancen\\[-1ex]}
\newcommand{\textdn}{Risiken\\[-1ex]}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[font=\small,
any/.style={draw, text width=.5\linewidth-1cm, align=center, anchor=center, inner sep=1pt},
row 1/.style={nodes={any, minimum height=1cm, fill=black!10}},
row 2/.style={nodes={any, minimum height=9cm}},
row 3/.style={nodes={any, minimum height=8.2cm}},
row 2 column 1/.style={nodes={any, minimum height=1cm, fill=black!10, rotate=90, minimum width=9cm}},
row 3 column 1/.style={nodes={any, minimum height=1cm, fill=black!10, rotate=90, minimum width=8.2cm}}
]
\matrix (SWOT) [matrix of nodes,
column sep=-1\pgflinewidth,
row sep=-1\pgflinewidth,
inner sep=0pt]
{
& {\texta} & {\textb} \\
{\textcn} & \begin{itemize}
\item E-supply chain, global distributed production
\item Unique topological optimized products
\item Multi material and graded structures are possible (S)
\item Economies of scale: series of 1
\item On-demand production
\item High buy-to-fly ratio
\item Sustainable production
\item Knowledge intensive processes
\end{itemize} &\begin{itemize}
\item Not sufficient standardization of new technologies (S)
\item Low process speed - high cost per part
\item Real-time process control is required (S)
\item No material standards available (S)
\item Part accuracy is low, post processing needed (S)
\item High material cost (S)
\item No process specific test method available (S)
\item Not sufficient education of users
\end{itemize} \\
{\textdn} & \begin{itemize}
\item AM and traditional manufacturing hybrid combination
\item Integration of AM in existing production line (S)
\item Customized design - introduction of new design tools (S)
\item Multi-material and smart products (S)
\item Material recycle (S)
\item New business models for DDM (S)
\item High potential in high tech industries
\end{itemize} & \begin{itemize}
\item Not many OEMs in Europe
\item Limited knowledge of AM
\item More competition will arise
\end{itemize} \\
};
\node[below right =1mm of SWOT.south west] {S indicates standardization ongoing activities};
\end{tikzpicture}
\caption{SWOT Analysis for additive manufacturing}
\label{tab:swot}
\end{figure}
\end{document}
我已经将 documentclass、字体大小更改为 12pt,并包含了 polyglossia 和 fontspec,得到的结果如下所示:
我不知道如何固定框的位置(除了将字体大小设置为 11pt),我也不知道如何在顶部添加多列(文本“Interne Analyse”)并在左侧添加带有旋转文本的多行(文本“externe Analyse”)。
答案1
要固定单元格的大小,您必须指定一个更大的值minimum height
。不幸的是,您必须通过反复试验来找到正确的值。
要放置“宽”单元格,您可以使用一些技巧。一旦 tikz 矩阵排版完毕,就会有多个节点名称可用。例如,(SWOT-2-3.north west)
在矩阵的第二行、第三列中表示单元格的西北角。使用这个想法,您可以绘制一个延伸到几行或几列之间的矩形,如下例所示:
\documentclass[tikz, border=5pt]{standalone}
\usepackage{polyglossia}
\usepackage{fontspec}
\usepackage{times}
\usepackage{tikz}
\usetikzlibrary{matrix, positioning,calc}
\setmainlanguage{german}
\newcommand{\texta}{Stärken\\[-1ex]}
\newcommand{\textb}{Schwächen\\[-1ex]}
\newcommand{\textcn}{Chancen\\[-1ex]}
\newcommand{\textdn}{Risiken\\[-1ex]}
\begin{document}
\begin{tikzpicture}[font=\small,
any/.style={draw, text width=.5\linewidth-1cm, align=center, anchor=center, inner sep=5pt},
row 1/.style={nodes={any, minimum height=1cm, fill=black!10}},
row 2/.style={nodes={any, minimum height=9cm}},
row 3/.style={nodes={any, minimum height=8cm}},
row 2 column 1/.style={nodes={any, minimum height=1cm, fill=black!10, rotate=90, minimum width=9cm}},
row 3 column 1/.style={nodes={any, minimum height=1cm, fill=black!10, rotate=90, minimum width=8cm}}
]
\matrix (SWOT) [matrix of nodes, inner sep=0pt,
column sep=-1\pgflinewidth,
row sep=-1\pgflinewidth,
inner sep=0pt]
{
& {\texta} & {\textb} \\
{\textcn} & \begin{itemize}
\item E-supply chain, global distributed production
\item Unique topological optimized products
\item Multi material and graded structures are possible (S)
\item Economies of scale: series of 1
\item On-demand production
\item High buy-to-fly ratio
\item Sustainable production
\item Knowledge intensive processes
\end{itemize} &\begin{itemize}
\item Not sufficient standardization of new technologies (S)
\item Low process speed - high cost per part
\item Real-time process control is required (S)
\item No material standards available (S)
\item Part accuracy is low, post processing needed (S)
\item High material cost (S)
\item No process specific test method available (S)
\item Not sufficient education of users
\end{itemize} \\
{\textdn} & \begin{itemize}
\item AM and traditional manufacturing hybrid combination
\item Integration of AM in existing production line (S)
\item Customized design - introduction of new design tools (S)
\item Multi-material and smart products (S)
\item Material recycle (S)
\item New business models for DDM (S)
\item High potential in high tech industries
\end{itemize} & \begin{itemize}
\item Not many OEMs in Europe
\item Limited knowledge of AM
\item More competition will arise
\end{itemize} \\
};
\node[below right =1mm of SWOT.south west] {S indicates standardization ongoing activities};
\draw[fill=black!10] ($(SWOT-1-2.north west)+(\pgflinewidth/2,-\pgflinewidth/2)$) rectangle ($(SWOT-1-3.north east)+(-\pgflinewidth/2,-\pgflinewidth/2+1cm)$)
node[midway] {Interne Analyse};
\draw[fill=black!10] ($(SWOT-3-1.north west)+(-1cm+\pgflinewidth/2,\pgflinewidth/2)$) rectangle ($(SWOT-2-1.north east)+(\pgflinewidth/2, -\pgflinewidth/2)$)
node[midway, rotate=90] {Externe Analyse};
\end{tikzpicture}
\end{document}
代码的最后一部分(\draw[fill=black!10]
等等)绘制了“多列”和“多行”单元格,特别丑陋,因为我必须考虑线宽才能获得完美的对齐。不过结果还是不错的:
答案2
我认为你不需要 tikz 图片。以下是使用threeparttable, tabularx, rotating, multirow, hhline
和获得结果的一种方法xcolor
:
\documentclass[12pt,a4paper]{scrartcl}
\usepackage{polyglossia}
\usepackage{fontspec}
\setmainlanguage{german}
\setotherlanguage{english}
\setmainfont{Times New Roman}
\setsansfont{TeXGyreHeros}
\usepackage{tabularx, makecell, hhline, multirow, rotating, threeparttable}
\usepackage[table, x11names, svgnames]{xcolor}
\usepackage{enumitem}
\renewcommand{\tabularxcolumn}[1]{>{\columncolor{Lavender!60}\raggedright\arraybackslash}m{#1}}
\renewcommand\theadfont{\normalsize\bfseries}
\KOMAoptions{captions=abovetable}
\setkomafont{caption}{\sffamily}
\setkomafont{captionlabel}{\sffamily}
\begin{document}
\begin{table} %
\begin{threeparttable}
\sffamily
\setlength\extrarowheight{3pt}\setlength\arrayrulewidth{2pt}\arrayrulecolor{white}
\setlist[itemize, 1]{wide=0pt, leftmargin=*, itemsep=-1pt, topsep=5pt, after =\vspace*{\dimexpr-\baselineskip+\topsep}}
\caption{SWOT Analysis for additive manufacturing}
\begin{tabularx}{\linewidth}{>{\columncolor{lightgray!60}}c|>{\columncolor{lightgray!60}}c|X|X|}
\rowcolor{lightgray!60}\multicolumn{2}{c|}{} & \multicolumn{2}{c|}{Interne\enspace Analyse} \\
\hhline{>{\arrayrulecolor{lightgray!60}}-->{\arrayrulecolor{white}}|--}
\rowcolor{lightgray!60}\multicolumn{2}{c|}{} & \centering\textbf{Stärcken (Strengths)} & \thead{Schwärchen (Weaknesses)} \\%
\cline{3-4}%
\hhline{>{\arrayrulecolor{white}}~~|--}
& \multirow{9}{*}{\enspace\turnbox{90}{Chancen (Opportunities)}}& \begin{itemize}
\item E-supply chain, global distributed production
\item Unique topological optimized products
\item Multi material and graded structures are possible (S)
\item Economies of scale: series of 1
\item On-demand production
\item High buy-to-fly ratio
\item Sustainable production
\item Knowledge intensive processes
\end{itemize}%
&\begin{itemize}
\item Not sufficient standardization of new technologies (S)
\item Low process speed –\,high cost per part
\item Real-time process control is required (S)
\item No material standards available (S)
\item Part accuracy is low, post processing needed (S)
\item High material cost (S)
\item No process specific test method available (S)
\item Not sufficient education of users
\end{itemize} \\
\hhline{>{\arrayrulecolor{lightgray!60}}->{\arrayrulecolor{white}}|---}
\multirow{-10}{*}{\quad\turnbox{90}{Externe\enspace Analyse}\enspace} & \multirow{7}{*}{\quad\turnbox{90}{Gefahren (Threats)}\enspace} & \begin{itemize}
\item AM and traditional manufacturing hybrid combination
\item Integration of AM in existing production line (S)
\item Customized design –\,introduction of new design tools (S)
\item Multi-material and smart products (S)
\item Material recycle (S)
\item New business models for DDM (S)
\item High potential in high tech industries
\end{itemize}
& \begin{itemize}
\item Not many OEMs in Europe
\item Limited knowledge of AM
\item More competition will arise
\end{itemize}
\end{tabularx}
\begin{tablenotes}[flushleft]\footnotesize\smallskip
\item S indicates standardisation ongoing activities.
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}