答案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
)。它使用真实文本而不是框来显示内容:
以下是该图的源代码(一点也不优雅):
\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}