是否有一张图片显示列表中使用的所有长度?

是否有一张图片显示列表中使用的所有长度?

我想调整列表中的长度参数(恰好是为了使其更简洁,但这并不重要)。我很少这样做,以至于我记不住所有涉及的长度,每次都必须查找它们。但我通常找到的参考资料(通过搜索引擎或其他方式)往往是纯粹的描述性的。作为一个非常注重视觉的学习者,如果我有一张图表可以看(类似于由layout包裹)。

是否存在这样的图表来显示列表中的长度如何组合在一起?

请注意,即使我使用如下包enumitem为了进行实际的调整,我仍然必须对所涉及的长度有一个合理的了解。

(如果答案是“否”并且有人画了一张,或者答案是“是的,但是这里有一个更好的”,那么当我被允许时,我会很乐意为这个问题增加悬赏并将其奖励给最漂亮的图表。)

答案1

你需要包裹layouts

\documentclass{article}
\usepackage{layouts}

\begin{document}
\drawlist

\begin{enumerate}
\item foo
\currentlist
\begin{figure}
\listdesign
\end{figure}
\end{enumerate}
\end{document}

在此处输入图片描述

在此处输入图片描述

答案2

图片TeX 指南第 4.4.2 节,使用 TikZ:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{chains}
\usepackage{makecell}

\begin{document}
  \begin{tikzpicture}[start chain=going below,node distance=8mm,
  main/.style={minimum width=10cm},
  para/.style={minimum width=5cm,minimum height=1.5cm}]
  \scope[very thick]
  \node[on chain,main,anchor=south west] (prec) {Text};
  \draw (prec.north west) -- (prec.south west) -| (prec.north east);

  \node[on chain,para] (item1-1) {\hspace{4em}\makecell[l]{Item 1\\Para 1}};
  \coordinate (p1-1) at (item1-1.150 |- item1-1.175);
  \draw (p1-1) |- (item1-1.north east) |- (item1-1.south west)
               -- (p1-1 -| item1-1.south west) -- cycle;

  \node[on chain,para] (item1-2) {\hspace{4em}\makecell[l]{Item 1\\Para 2}};
  \coordinate (p1-2) at (item1-2.130 |- item1-2.175);
  \draw (p1-2) |- (item1-2.north east) |- (item1-2.south west)
               -- (p1-2 -| item1-2.south west) -- cycle;

  \node[on chain,para] (item2) {\hspace{4em}Item 2};
  \coordinate (p2) at (item2.150 |- item2.175);
  \draw (p2) |- (item2.north east) |- (item2.south west)
             -- (p2 -| item2.south west) -- cycle;

  \node[on chain,main] (follow) {Text};
  \draw (follow.south west) -- (follow.north west) -| (follow.south east);

  \node[left=0.5cm of item1-1.north west,anchor=north east,draw]
    (label1) {Label};
  \node[left=0.5cm of item2.north west,anchor=north east,draw]
    {Label};
  \endscope

  \scope[>=latex,<->,shorten <=1pt,shorten >=1pt,font={\ttfamily\small},auto,
    every node/.style={midway}]
  \draw (prec) -- (item1-1)
    node{\string\topsep\ + \string\parskip\ [+ \string\partopsep]};
  \draw (item1-1) -- (item1-2)
    node{\string\parsep};
  \draw (item1-2) -- (item2)
    node{\string\itemsep\ + \string\parsep};
  \draw (item2) -- (follow)
    node{\string\topsep\ + \string\parskip\ [+ \string\partopsep]};
  \draw[<->|] (item1-1) -- (item1-1 -| prec.south west)
    node {\string\leftmargin};
  \draw[<->|,swap] (item1-1) -- (item1-1 -| prec.south east)
    node {\string\rightmargin};
  \draw (label1) -- (label1 -| p1-1)
    node{\string\labelsep};
  \draw[|<->|,transform canvas={yshift=2mm}]
    (label1.north west) -- (label1.north east)
    node{\string\labelwidth};
  \draw[|<->,transform canvas={yshift=-2mm}]
    (p1-1) -- (p1-1 -| item1-1.north west)
    node[near end,anchor=north west]{\string\itemindent};
  \draw[<->|,transform canvas={yshift=5mm},swap]
    (p1-2) -- (p1-2 -| item1-2.north west)
    node{\string\listparindent};
  \endscope
  \end{tikzpicture}

\end{document}

它看起来比 生产的更好layouts。我在我的一本中文书中用过它。

在此处输入图片描述

答案3

我用 TikZ 为我的做了一个LaTeX 备忘单(法语),但仅适用于{itemize}(所以不显示\labelwidth)。它使用真实文本而不是框来显示内容:

显示 itemize 长度的图表

以下是该图的源代码(一点也不优雅):

\documentclass[a4paper]{article}

\usepackage[garamond]{mathdesign}

\usepackage{calc}
\usepackage{colortbl}

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

\begin{document}

\begin{center}\tabcolsep=0.5em
\begin{tabular}{ll}\cellcolor{orange!7}
\begin{minipage}[b]{8.1cm}
\newcommand{\chosenlistbullet}{\textbullet}
\newcommand{\showlistlength}[1]{\texttt{\scriptsize#1}}
\newcommand{\showlistlengthprecision}[1]{\textnormal{\scriptsize(#1)}}
\begin{tikzpicture}[inner sep=0pt]

\node (text before) {\begin{minipage}[t]{\linewidth}
Bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla bla bla bla bla.
\end{minipage}};

\node (first item par1) [below=10mm of text before] {\hspace*{1.5cm}\begin{minipage}[t]{\linewidth-3cm}\leavevmode
\llap{\chosenlistbullet\hspace{0.33cm}}%
\hspace*{0.33cm}\llap{\smash{\tikz[baseline] \draw[<->,color=violet] (0,0) -- (0.66cm,0) node[pos=0.5,below left,inner sep=3pt] {\showlistlength{labelsep}};}}\llap{\smash{\tikz[baseline=-1ex] \draw[<->,color=green!40!black] (0,0) -- (0.33cm,0) node[above left,inner sep=3pt] {\showlistlength{itemindent}};}}Bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla bla.
\end{minipage}\hspace*{1.5cm}};

\node (first item par2) [below=5mm of first item par1] {\hspace*{1.5cm}\begin{minipage}[t]{\linewidth-3cm}\leavevmode
\hspace{0.5cm}\llap{\smash{\tikz[baseline] \draw[<->,color=green!40!black] (0,0) -- (0.5cm,0) node[above left,inner sep=3pt] {\showlistlength{listparindent}};}}Bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla. 
\end{minipage}\hspace*{1.5cm}};

\node (second item) [below=5mm of first item par2] {\hspace*{1.5cm}\begin{minipage}[t]{\linewidth-3cm}\leavevmode
\llap{\chosenlistbullet\hspace{0.33cm}}%
\hspace*{0.33cm}\llap{\smash{\tikz[baseline] \draw[<->,color=violet] (0,0) -- (0.66cm,0) node[pos=0.5,below left,inner sep=3pt] {\showlistlength{labelsep}};}}\llap{\smash{\tikz[baseline=-1ex] \draw[<->,color=green!40!black] (0,0) -- (0.33cm,0) node[above left,inner sep=3pt] {\showlistlength{itemindent}};}}Bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla bla.
\end{minipage}\hspace*{1.5cm}};

\node (text after) [below=10mm of second item] {\begin{minipage}[t]{\linewidth}
Bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla bla bla bla bla bla bla bla.
\end{minipage}};

\draw[<->,color=blue] (text before.south) -- ($ (text before.south)!.5!(first item par1.north) $) node[pos=0.5,right,inner sep=3pt] {\showlistlength{partopsep} \showlistlengthprecision{if blank line before the list}};

\draw[<->,color=blue] ($ (text before.south)!.5!(first item par1.north) $) -- (first item par1.north) node[pos=0.5,right,inner sep=3pt] {\showlistlength{topsep\,+\,parskip}};

\draw[<->,color=blue] (first item par1.south) -- (first item par2.north) node[pos=0.5,right,inner sep=3pt] {\showlistlength{parsep}};

\draw[<->,color=blue] (first item par2.south) -- (second item.north) node[pos=0.5,right,inner sep=3pt] {\showlistlength{itemsep\,+\,parsep}};

\draw[<->,color=blue] (second item.south) -- ($ (second item.south)!.5!(text after.north) $) node[pos=0.5,right,inner sep=3pt] {\showlistlength{topsep\,+\,parskip}};

\draw[<->,color=blue] ($ (second item.south)!.5!(text after.north) $) -- (text after.north) node[pos=0.5,right,inner sep=3pt] {\showlistlength{partopsep} \showlistlengthprecision{if blank line before the list}};

\draw[<->,color=violet] (first item par2.west) -- ($ (first item par2.west) + (1.5cm,0cm) $) node[pos=0.5,below,inner sep=3pt] {\showlistlength{leftmargin}};

\draw[<->,color=violet] (first item par2.east) -- ($ (first item par2.east) + (-1.5cm,0cm) $) node[pos=0.5,below,inner sep=3pt] {\showlistlength{rightmargin}};

\end{tikzpicture}
\end{minipage}
&
\newcommand{\showlistlength}[2][blue]{\textcolor{#1}{\texttt{#2}}:}
\begin{tikzpicture}
\node {\begin{minipage}{6cm}\parskip=2pt
\showlistlength{topsep} space before and after \par
\showlistlength{partopsep} additional space before and after if the list is preceded by a blank line \par
\showlistlength{itemsep} space between items \par
\showlistlength{parsep} space between paragraphs of an item \par
\showlistlength[violet]{leftmargin} left margin \par
\showlistlength[violet]{rightmargin} right margin \par
\showlistlength[violet]{labelsep} space between label and text \par
\showlistlength[green!40!black]{itemindent} indentation of the first paragraphs of an item \par
\showlistlength[green!40!black]{listparindent} indentation of the other paragraphs of an item\par
\end{minipage}};
\end{tikzpicture}
\\
\end{tabular}\end{center}

\end{document}

相关内容