Как добраться, две дословных среды в плавает с автоматическим вводом субтитров бок о бок?
\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}
Так в основном мне просто нужны те примеры, чтобы быть бок о бок (и хранение автоматического nunbering подписи). Я пробовал некоторое время теперь.
Наконец-то нашел решение проблемы.
\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
пакета \captionof{fileformat}{Our Caption}
.
Используйте 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}
Для сред дословных
субтитров вы можете использовать списки
(которые предложат гораздо больше, чем просто субтитры, подсветка синтаксиса и нумерация строк также предоставляются бесплатно) или определить свои собственные float
с использованием одноименного пакета .
Пример (из 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}