盒子详情列表

盒子详情列表

我想知道是否有人知道如何“告诉”LaTeX 打印框索引(对我来说是“Recuadros”),类似于常规的表格索引。在最后一种情况下,不同部分的表格之间有一个额外的空格,而对于框,我无法做到这一点。

我制作盒子的方式是首先定义样式,然后定义盒子的编号(使用mdframed):....

\usepackage[framemethod=TikZ]{mdframed}
\mdfdefinestyle{MyFrame}{%
    nobreak,    
    linecolor=blue,
    outerlinewidth=0.5pt,
    roundcorner=20pt,
    innertopmargin=\baselineskip,
    innerbottommargin=\baselineskip,
    innerrightmargin=20pt,
    innerleftmargin=20pt,
    frametitlealignment=\center,
    backgroundcolor=gray!30!white}
\usepackage{tocloft}
\newcounter{infobox}
\newenvironment{infobox}[1][]{%
\refstepcounter{infobox}%
\begin{mdframed}[%
style=MyFrame,
frametitle={Recuadro \theinfobox\ #1},
]%
\addcontentsline{lob}{section}{\numberline{\theinfobox}#1}%
}{%
\end{mdframed}
}
\makeatletter
\newcommand\listboxname{Índice de recuadros}
\newcommand\listofboxes{
\chapter*{\listboxname}
\@starttoc{lob}
}
\renewcommand{\theinfobox}{\thechapter.\arabic{infobox}}
\makeatother
....

LaTeX 打印表格和框的结果的方式是:

在此处输入图片描述

您可以看到不同章节的表格之间有额外的空间,这就是我尝试为方框做的事情。

答案1

这是该类的解决方案book:稍微修改一下,以便在每个启动后\@chapter自动为文件添加垂直间距。.lob\chapter

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[framemethod=TikZ]{mdframed}
\mdfdefinestyle{MyFrame}{%
    nobreak,    
    linecolor=blue,
    outerlinewidth=0.5pt,
    roundcorner=20pt,
    innertopmargin=\baselineskip,
    innerbottommargin=\baselineskip,
    innerrightmargin=20pt,
    innerleftmargin=20pt,
    frametitlealignment=\center,
    backgroundcolor=gray!30!white}
\usepackage{tocloft}
\usepackage{xpatch}


\newcounter{infobox}[chapter]
\newenvironment{infobox}[1][]{%
  \refstepcounter{infobox}%
  \begin{mdframed}[%
    style=MyFrame,
    frametitle={Recuadro \theinfobox\ #1},
    ]%
    \addcontentsline{lob}{section}{\protect\numberline{\theinfobox~}#1}%
  }{%
  \end{mdframed}
}

\makeatletter
\xpatchcmd{\@chapter}{%
  \chaptermark{#1}%
}{
  \chaptermark{#1}%
  \addtocontents{lob}{\protect\addvspace{10\p@}}%
}{\typeout{success}}{}


%
\newcommand\listboxname{Índice de recuadros}
\newcommand\listofboxes{%
  \chapter*{\protect\listboxname}
  \@starttoc{lob}
}
\renewcommand{\theinfobox}{\thechapter.\arabic{infobox}}
\makeatother




\begin{document}
\tableofcontents
\listofboxes
\listoffigures
\chapter{First}
\begin{infobox}[Some box]
  And now for something completely different
\end{infobox}
\begin{figure}
  \caption{second}
\end{figure}

\begin{figure}
  \caption{second}
\end{figure}

\begin{figure}
  \caption{second}
\end{figure}


\chapter{Second}
\begin{infobox}[Some box]
  And now for something completely different
\end{infobox}

\begin{infobox}[Some box]
  And now for something completely different
\end{infobox}

\begin{figure}
  \caption{second}
\end{figure}

\end{document}

在此处输入图片描述

相关内容