Layout Latex两个字幕并排的逐字记录环境

Layout Latex两个字幕并排的逐字记录环境,layout,latex,tex,verbatim,Layout,Latex,Tex,Verbatim,如何在自动字幕并排的浮动中获得两个逐字记录环境 \usepackage{float,fancyvrb} ... \DefineVerbatimEnvironment{filecontents}{Verbatim}% {fontsize=\small, fontfamily=tt, gobble=4, frame=single, framesep=5mm, baselinestretch=0.8,

如何在自动字幕并排的浮动中获得两个逐字记录环境

\usepackage{float,fancyvrb}
...
\DefineVerbatimEnvironment{filecontents}{Verbatim}%
    {fontsize=\small,
        fontfamily=tt,
        gobble=4,
        frame=single,
        framesep=5mm,
        baselinestretch=0.8,
        labelposition=topline,
        samepage=true}

\newfloat{fileformat}{thp}{lof}[chapter]
\floatname{fileformat}{File Format}

\begin{fileformat}
    \begin{filecontents}
    A  B  C
    \end{filecontents}
    \caption{example.abc}
\end{fileformat}

\begin{fileformat}
    \begin{filecontents}
    C  B  A
    \end{filecontents}
    \caption{example.cba}
\end{fileformat}

所以基本上我只需要这些例子并排出现(并保持标题的自动无标题)。我已经尝试了一段时间。

使用本例中的minipage,它将两张图片并排放置在一个带有单独标题的数字浮标中

\begin{figure}[htbp]
  \centering
  \begin{minipage}[b]{5 cm}
    \includegraphics{filename 1} 
    \caption{caption 1}
    \label{labelname 1}
  \end{minipage}
  \begin{minipage}[b]{5 cm}
    \includegraphics{filename 2}  
    \caption{caption 2}
    \label{labelname 2}
  \end{minipage}
\end{figure}

对于字幕
逐字
环境,您可以使用
列表
(它提供的不仅仅是简单的字幕,语法突出显示和行号也免费提供),或者使用相同名称的定义您自己的
浮动
环境

示例(来自):


终于找到了答案

\usepackage{caption}

\begin{fileformat}[h]
  \centering
  \begin{minipage}[b]{0.4\textwidth}
    \begin{filecontents}
    A B C
    \end{filecontents}
    \captionof{fileformat}{example.abc}
  \end{minipage}
  \quad
  \begin{minipage}[b]{0.4\textwidth}
    \begin{filecontents}
    C B A
    \end{filecontents}
  \captionof{fileformat}{example.cba}
  \end{minipage}
\end{fileformat}

问题的解决方案是使用
caption
package宏
\captionof{fileformat}{Our caption}

独立于环境制作字幕,当然可以,但如何获得正确的自动字幕?图中显示的标题正确,但显示的前缀错误。如果我使用fileformat而不是figure,它只显示一个标题。啊,我想这就是定义自己标题放置样式的float包。您尝试过不同的\floatstyle{}选项吗?是的,尝试过-规则、普通、装箱。如果我不使用数字,它似乎不认为这是两个独立的东西。你使用数字吗?修改图形环境会比尝试使用float包更容易吗?是的,我正在使用图形、两个自定义float和lstlisting。我已经在使用listing包进行格式化算法,但我不知道有可能定义多个自动字幕。(如“算法”和“格式”的不同计数)。此外,我还不知道如何将这两个逐字记录环境并排放置。
\usepackage{caption}

\begin{fileformat}[h]
  \centering
  \begin{minipage}[b]{0.4\textwidth}
    \begin{filecontents}
    A B C
    \end{filecontents}
    \captionof{fileformat}{example.abc}
  \end{minipage}
  \quad
  \begin{minipage}[b]{0.4\textwidth}
    \begin{filecontents}
    C B A
    \end{filecontents}
  \captionof{fileformat}{example.cba}
  \end{minipage}
\end{fileformat}