gpt4 book ai didi

layout - Latex 并排两个带标题的逐字环境

转载 作者:行者123 更新时间:2023-12-04 12:01:06 24 4
gpt4 key购买 nike

如何在带有自动并排字幕的花车中获得两个逐字逐字的环境?

\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}

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

最佳答案

字幕 verbatim您可以使用的环境 listings (这将提供的不仅仅是简单的字幕,语法突出显示和行编号也免费提供)或定义您自己的 float使用 package 的环境同名。

一个例子(来自 WikiBooks ):

\documentclass{article}

\usepackage{float}

\floatstyle{ruled}
\newfloat{program}{thp}{lop}
\floatname{program}{Program}

\begin{document}

\begin{program}
\begin{verbatim}

class HelloWorldApp {
public static void main(String[] args) {
//Display the string
System.out.println("Hello World!");
}
}
\end{verbatim}
\caption{The Hello World! program in Java.}
\end{program}

\end{document}

关于layout - Latex 并排两个带标题的逐字环境,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2983839/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com