tikz 内でノード/構造体をフォーマットするにはどうすればよいですか?

tikz 内でノード/構造体をフォーマットするにはどうすればよいですか?

私は以下を作成しましたアイゼンハワー スクエア (またはマトリックス)これに触発されて素晴らしい答え:

アイソンハワー広場

私は、もっとスペース効率の高いものにしたいと思っています。たとえば、テキスト サイズやチェック ボックスを小さくし、境界線を細くし、四角形の間にスペースや余白や溝を入れず、四角形の中に水平線を入れないなどです。
左側のテキストは、チェック リスト項目のテキストの最大サイズに近いものになっています。

しかし、何度もいじくり回した後でも、以下のプロパティを変更することはできません。

  1. 国境
    • 境界線を極細にする(1ピクセルで十分)
  2. チェックリスト項目/ボックス
    • 水平線を削除する
    • 各チェックリスト項目のチェックを\Box小さくしたり、テキストに合わせて拡大縮小したりする
    • アイテムを垂直方向に密集/接近させますか?
  3. label文章
    • 個々の四角形の左端/上端に中央揃え

以下は私の文書です:

main.tex

\documentclass[english]{book}

\usepackage{amssymb, tikz}
\usetikzlibrary{shapes.multipart, positioning, fit, backgrounds}

...

% \eisenbox: for making each box of an Eisenhower square
\newcommand{\eisenbox}[6][] {
    \node [rectangle split,rectangle split parts={#6}, fill=white,
    text width=5.25cm,align=left,text=#2,draw,sharp corners,draw=#2,
    #1]
    (multi-#3)
    {\strut$\Box$\nodepart{two}\strut$\Box$\nodepart{three}\strut$\Box$\nodepart{four}\strut$\Box$
    \nodepart{five}\strut$\Box$\nodepart{six}\strut$\Box$\nodepart{seven}\strut$\Box$
    \nodepart{eight}\strut$\Box$\nodepart{nine}\strut$\Box$\nodepart{ten}\strut$\Box$};
    \node[left=1pt of multi-#3.south west,anchor=south west,rotate=90,text=black] 
    (label-#3) {#5};
    
    \begin{scope}[on background layer]
        \node[fit=(multi-#3),fill=#2,sharp corners,
        label={[text=#2,anchor=south west,font=\bfseries]above left:#4}] (fit-#3){};
    \end{scope}
}

% \eisensquare: creates a fancy Eisenhower square
\newcommand{\eisensquare}[1] {
    \eisenbox{black}{tl}{\footnotesize Urgent}{\footnotesize Important}{#1}
    \eisenbox[right=0.2cm of multi-tl]{black}{tr}{\footnotesize Not Urgent}{}{#1}
    \eisenbox[below=0.2cm of multi-tl]{black}{bl}{}{\footnotesize Not Important}{#1}
    \eisenbox[right=0.2cm of multi-bl]{black}{br}{}{}{#1}
}

...

\begin{document}
    \frontmatter

    \maketitle
    ...

    \mainmatter

    ...
    \subfile{./folder/subfile.tex}

    \backmatter

\end{document}

subfile.tex

\documentclass[../main.tex]{subfiles}

    \begin{document}

    ...
    
    \paragraph{Foo}\mbox{}\\    
        \begin{tikzpicture}[font=\sffamily]
            \eisensquare{7}
        \end{tikzpicture}
    
    ...

\end{document}

何が間違っているのかわかりません。 内のどこに 、 などを配置tikzしても、無視されるかエラーがスローされます。widthline width\node [options]\eisenbox

私は全くの初心者ですpgf/tikz、どんな意見でもいただければ大変ありがたく思います。

編集1 ------------

に従ってゲルノットの 模範的な回答ほぼ完成しました。あとは、各象限のアイテム数を可変にするための修正だけです。これを長期間毎日使用するのでなければ、通常はそこまでこだわることはありません。

残り行数がアイテム数より多い場合に、空白行を作成するにはどうすればよいでしょうか?

main.tex

\newcommand\eisenlabel[1]{{\footnotesize\sffamily#1}}

% arguments: 1st is total # lines, 2nd is # items
\newcommand{\eisenbox}[2]{\fbox{%
        \begin{tabular}{l}
            \multido{}{#1}{%
                \makebox[0.44\textwidth][l]{$\square$} %adding \\ here makes errors, but I believe its absence is FUBARing the table
            }
        \end{tabular}%
}}

% first argument: max lines, then items per quadrant starting with urgent+important
% could do this without 1st arg by determining largest value
% but not familiar enough with this so we'll just supply it manually (for now)
\newcommand{\eisensquare}[5] {%
    \fboxrule=0.1ex% <<< adjust line width
    \begin{tabular}{@{}r@{\hspace{0.3em}}c@{\hspace{-\fboxrule}}c@{}} % <<< adjust distance between rotated labels and box
        & \eisenlabel{urgent} & \eisenlabel{not urgent} \\
        \turnbox{90}{\makebox[0pt]{\eisenlabel{important}}}
        & \eisenbox{#1}{#2} & \eisenbox{#1}{#3} \\[-\fboxrule] 
        \turnbox{90}{\makebox[0pt]{\eisenlabel{not important}}}
        & \eisenbox{#1}{#4} & \eisenbox{#1}{#5}
    \end{tabular}%
}

subfile.tex

\(\eisensquare{5}{3}{4}{5}{3}\)

答え1

柔軟な解決策があります。\multidoは ではうまく動作しないのでtabular、さらに基本的なコマンドを使用しました。トップレベルのコマンドは

\eisensquare{height of single box}{width of single box}{top left}{top right}{bottom left}{bottom right}

heightwidth絶対的な寸法、または (線の高さ) や のような長さの倍数にすることができ\baselineskipます\textwidth

ここに画像の説明を入力してください

\documentclass{article}
\usepackage{amssymb,rotating,multido}
% \eisenlabel{width}{label}
\newcommand\eisenlabel[2]{\makebox[#1]{\footnotesize\sffamily#2}}
% \veisenlabel{height}{label}
\newcommand\veisenlabel[2]{\turnbox{90}{\eisenlabel{#1}{#2}}\ }
% \eisenbox{height}{width}{number of items}
\newcommand\eisenbox[3]{\fbox{%
  \vbox to #1{%
    \multido{}{#3}{\hbox to #2{$\square$\hfill}}%
    \vfill  
  }%
}}
% \eisensquare{height of single box}{width of single box}{top left}{top right}{bottom left}{bottom right}
\newcommand\eisensquare[6]{{%
  \fboxrule=0.1ex%
  \vbox{%
    \hbox{\ \eisenlabel{#2}{urgent}\ \eisenlabel{#2}{not urgent}}%
    \hbox{\veisenlabel{#1}{important}\eisenbox{#1}{#2}{#3}\hspace{-\fboxrule}\eisenbox{#1}{#2}{#4}}%
    \nointerlineskip
    \vspace{-\fboxrule}%
    \hbox{\veisenlabel{#1}{not important}\eisenbox{#1}{#2}{#5}\hspace{-\fboxrule}\eisenbox{#1}{#2}{#6}}%
}}}
\begin{document}
\noindent
\eisensquare{5\baselineskip}{0.4\textwidth}{3}{4}{5}{3}

\noindent
\eisensquare{2cm}{5cm}{3}{4}{5}{3}
\end{document}

答え2

Tikz は素晴らしいパッケージですが、このようなシンプルなデザインの場合は表形式を使用することをお勧めします。外観を変更する場所がより明確になる場合があります。

ここに画像の説明を入力してください

em長さの単位はフォント サイズによって変わるため、またはを使用することをお勧めしますex。コードでは、ボックスの幅、線の幅、垂直ラベルの距離を調整する場所をマークしました。

\documentclass{article}
\usepackage{amssymb,rotating}
\newcommand\eisenlabel[1]{{\footnotesize\sffamily#1}}
\newcommand\eisenline{\makebox[0.44\textwidth][l]{$\square$}}% <<< adjust width of boxes
\newcommand\eisenbox{\fbox{%
  \begin{tabular}{l}
    \eisenline\\
    \eisenline\\
    \eisenline\\
    \eisenline\\
    \eisenline\\
    \eisenline\\
    \eisenline
  \end{tabular}%
}}
\newcommand\eisensquare{{%
  \fboxrule=0.1ex% <<< adjust line width
  \begin{tabular}{@{}r@{\hspace{0.3em}}c@{\hspace{-\fboxrule}}c@{}} % <<< adjust distance between rotated labels and box
    & \eisenlabel{urgent} & \eisenlabel{not urgent} \\
  \turnbox{90}{\makebox[0pt]{\eisenlabel{important}}}
    & \eisenbox & \eisenbox \\[-\fboxrule] 
  \turnbox{90}{\makebox[0pt]{\eisenlabel{not important}}}
    & \eisenbox & \eisenbox
  \end{tabular}%
}}
\begin{document}
\noindent
\eisensquare
\end{document}

関連情報