tikz add tag
Anonymous 1535
I have the following code:

```
\documentclass[a4paper]{article}

\usepackage[margin=1.25in]{geometry}

\usepackage{tikz}
\usetikzlibrary{calc,matrix,positioning}

\title{}
\author{}
\date{}

\begin{document}

\begin{tikzpicture}[
  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]
{
& Helpful & Harmful \\
Internal & \textbf{Strengths} \begin{itemize}
  \item E-supply chain, global distributed production
  \item Unique topological optimised products
  \item Multi material and graded structures are possible
  \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} & \textbf{Weaknesses} \begin{itemize}
  \item Not sufficient standardisation of new technologies
  \item Low process speed - high cost per part
  \item Real-time process control is required
  \item No material standards available
  \item Part accuracy is low, post processing needed
  \item High material cost
  \item No process specific test method available
  \item Not sufficient education of users
\end{itemize} \\
External & \textbf{Opportunities} \begin{itemize}
  \item AM and traditional manufacturing hybrid combination
  \item Integration of AM in existing production line
  \item Customised design - introduction of new design tools
  \item Multi-material and smart products
  \item Material recycle
  \item New business models for DDM
  \item High potential in high tech industries
\end{itemize} & \textbf{Threats} \begin{itemize}
  \item Not many OEMs in Europe
  \item Limited knowledge of AM
  \item More competition will arise
\end{itemize} \\
};
\end{tikzpicture}

\end{document}
```

First of all, is this the best way to do this...as in is a shorter or improved code possible? Because if possible I would like the rows to automatically adjust depending on the content inside the boxes? My main problem is that I am having a problem with the `\textbf` text and its contents not remaining on the top (like the strengths and threats). Also, some lines are darker than others as there are 2 lines being joined together. How can I solve this please?
Top Answer
user 3.14159
I am not sure if this qualifies for a real answer. Anyway, here is something based on the `nicematrix` package that may come close. Some comments are in order:
1. Both for the Ti*k*Z matrix and for the `nicematrix` approach in order to vertically center the texts in the first column and at the same time to top-align the other cells one needs to "know" the heights of the latter cells. This problem gets solved by nesting `tabular`s.
2. I added a couple of `enumitem` keys to style the itemize lists. 

```
\documentclass[a4paper]{article}
\usepackage[margin=1.25in]{geometry}
\usepackage{tikz}
\usepackage{nicematrix}
\usepackage{enumitem}
\begin{document}
\begingroup
\renewcommand{\arraystretch}{1.2}
\setlist{left=1em,parsep=0.5ex,after=\medskip}
\begin{NiceTabular}{cc}[colortbl-like,hvlines-except-corners,
code-before = \cellcolor{black!10}{1-2,2-1,3-1}]
& \renewcommand{\arraystretch}{1.3}\begin{tabular}{Wc{6cm}|Wc{6cm}}
Helpful & Harmful\\ 
\end{tabular}\\
\rotate Internal
  & \begin{tabular}{p{6cm}|p{6cm}}
	\textbf{Strengths} \begin{itemize}
  \item E-supply chain, global distributed production
  \item Unique topological optimised products
  \item Multi material and graded structures are possible
  \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}
& 
 \textbf{Weaknesses} \begin{itemize}
  \item Not sufficient standardisation of new technologies
  \item Low process speed - high cost per part
  \item Real-time process control is required
  \item No material standards available
  \item Part accuracy is low, post processing needed
  \item High material cost
  \item No process specific test method available
  \item Not sufficient education of users
\end{itemize} \end{tabular}\\
\rotate External & \begin{tabular}{p{6cm}|p{6cm}}
	\textbf{Opportunities} \begin{itemize}
  \item AM and traditional manufacturing hybrid combination
  \item Integration of AM in existing production line
  \item Customised design - introduction of new design tools
  \item Multi-material and smart products
  \item Material recycle
  \item New business models for DDM
  \item High potential in high tech industries
\end{itemize} & \textbf{Threats} \begin{itemize}
  \item Not many OEMs in Europe
  \item Limited knowledge of AM
  \item More competition will arise
\end{itemize} \end{tabular}\\
\end{NiceTabular}\endgroup
\end{document}
```
![Screen Shot 2020-12-23 at 11.42.42 AM.png](/image?hash=16288c7230e0778b9fc691231f02d4f5b1c04411963e6a2213b86d2a38c3b458)

The same strategy can be used in a Ti*k*Z matrix, where we can put `tabular`s in the cells, too. This is a bit more efforts but it does not require recompilations and should work on older TeX installations as well as the arXiv. (I personally would use `nicematrix` if have access to an up-to-date installation.)

```
\documentclass[a4paper]{article}
\usepackage[margin=1.25in]{geometry}
\usepackage{array}
\usepackage{tikz}
\usetikzlibrary{backgrounds,matrix}
\makeatletter
\tikzset{SWOT/.style={matrix of nodes,inner sep=0pt,row sep=0pt,column sep=0pt,
cells={nodes={anchor=center,inner sep=2pt}},
column 1/.style={nodes={rotate=90,minimum height=8mm}},
ampersand replacement=\&,
execute at end matrix={\begin{scope}[on background layer]
 \fill[black!10] (\tikz@fig@name.west|-\tikz@fig@name-2-2.north) rectangle 
  (\tikz@fig@name-\the\pgfmatrixcurrentrow-2.south west);
\end{scope}
\draw (\tikz@fig@name.west|-\tikz@fig@name-2-2.north) rectangle 
(\tikz@fig@name-\the\pgfmatrixcurrentrow-\the\pgfmatrixcurrentcolumn.south east)
 (\tikz@fig@name-1-2.north west) rectangle 
(\tikz@fig@name-\the\pgfmatrixcurrentrow-\the\pgfmatrixcurrentcolumn.south east)
(\tikz@fig@name-2-2.center|-\tikz@fig@name.north) --
 (\tikz@fig@name-2-2.center|-\tikz@fig@name.south)
foreach \XX in {2,...,\the\numexpr\pgfmatrixcurrentrow-1}
{(\tikz@fig@name-\XX-2.south-|\tikz@fig@name.west) --
(\tikz@fig@name-\XX-2.south-|\tikz@fig@name.east) };
}}}
\makeatother
\usepackage{enumitem}
\begin{document}
\begin{tikzpicture}
\renewcommand{\arraystretch}{1.2}
\setlist{left=1em,parsep=0.5ex,after=\smallskip}
\def\myw{6cm}
\matrix[SWOT] 
{
\& |[fill=black!10]|\renewcommand{\arraystretch}{1.3}\begin{tabular}{Wc{\myw}Wc{\myw}}
Helpful & Harmful\\ 
\end{tabular}\\
 Internal
  \& \begin{tabular}{p{\myw}p{\myw}}
	\textbf{Strengths} \begin{itemize}
  \item E-supply chain, global distributed production
  \item Unique topological optimised products
  \item Multi material and graded structures are possible
  \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}
& 
 \textbf{Weaknesses} \begin{itemize}
  \item Not sufficient standardisation of new technologies
  \item Low process speed - high cost per part
  \item Real-time process control is required
  \item No material standards available
  \item Part accuracy is low, post processing needed
  \item High material cost
  \item No process specific test method available
  \item Not sufficient education of users
\end{itemize} \end{tabular}\\
 External \& \begin{tabular}{p{\myw}p{\myw}}
	\textbf{Opportunities} \begin{itemize}
  \item AM and traditional manufacturing hybrid combination
  \item Integration of AM in existing production line
  \item Customised design - introduction of new design tools
  \item Multi-material and smart products
  \item Material recycle
  \item New business models for DDM
  \item High potential in high tech industries
\end{itemize} & \textbf{Threats} \begin{itemize}
  \item Not many OEMs in Europe
  \item Limited knowledge of AM
  \item More competition will arise
\end{itemize} \end{tabular}\\
};
\end{tikzpicture}
\end{document}
```

![Screen Shot 2020-12-23 at 12.52.48 PM.png](/image?hash=9b3a1e370faa04d1bcbecc3b4de7589d12afc03502cc80e7bdcafe3833db1b1f)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.