floatrow 和 dirtree 发生冲突

floatrow 和 dirtree 发生冲突

我用它dirtree来可视化目录结构。它需要嵌入到浮动中,以避免分页符出现问题。除了加载时,floatrow我用它来获取边距标题等,这工作得很好。即使只是加载 floatrow 包也会搞砸dirtree。有没有可能的解决方案让这两个配合起来?

dirtree仅有的: 仅限目录树

dirtreefloatrow在此处输入图片描述

代码:

  \documentclass[8pt]{scrartcl}


  \usepackage{dirtree}

  %\usepackage{floatrow}
  \usepackage{blindtext}

  \begin{document}
  \blindtext

  %\thisfloatsetup{%
  %floatwidth=\linewidth,
  %capposition=beside,
  %capbesideposition={top,right},
  %capbesideframe=yes,
  %capbesidewidth=\marginparwidth,
  %capbesidesep=quad,
  %floatrowsep=qquad}
  \begin{figure}[t]
  \dirtree{%
  .1 Experiment/.
  .2 Analysis/ \dotfill  \begin{minipage}[t]{3cm}
  Very important folder{.}\end{minipage}.
  .2 TopSecret/ \dotfill \begin{minipage}[t]{3cm}
  For your eyes only.\end{minipage}.
  .3 Awesome Plots/.
  .3 Output.txt.
  .2 File.dat.
  }
  \caption{Directory Tree}
  \end{figure}

  \blindtext

  \end{document}

答案1

默认情况下,floatrow将浮动内容居中,因此objectset=raggedright在浮动的设置中添加涉及dirtree

\documentclass[8pt]{scrartcl}


\usepackage{dirtree}

\usepackage{floatrow}
\usepackage{blindtext}

\begin{document}
\blindtext

\thisfloatsetup{%
objectset=raggedright,
%floatwidth=\linewidth,
%capposition=beside,
%capbesideposition={top,right},
%capbesideframe=yes,
%capbesidewidth=\marginparwidth,
%capbesidesep=quad,
%floatrowsep=qquad
}
\begin{figure}[t]
\dirtree{%
.1 Experiment/.
.2 Analysis/ \dotfill\begin{minipage}[t]{3cm}
Very important folder{.}\end{minipage}.
.2 TopSecret/ \dotfill \begin{minipage}[t]{3cm}
For your eyes only.\end{minipage}.
.3 Awesome Plots/.
.3 Output.txt.
.2 File.dat.
}
\caption{Directory Tree}
\end{figure}

\blindtext

\end{document}

相关内容