3
如何創建兩個各自具有自己的計數器的存儲環境?LaTeX列表:針對不同列表環境的不同計數器
如果我使用例如
\lstnewenvironment{algorithm}[2]{
\renewcommand\lstlistingname{Algorithm}
\lstset{ ... }
} {}
\lstnewenvironment{program}[2]{
\renewcommand\lstlistingname{Program}
\lstset{ ... }
} {}
然後
\begin{algorithm}{Algorithm caption}{alg-label}
...
\end{algorithm}
\begin{program}{Program caption}{prg-label}
...
\end{program}
然後,他們將共享計數器,也就是說,它會導致例如在
Algorithm 1.1
...
Program 1.2
...
我想計算爲不同的上市環境是獨立的。
我也使用caption包創建一個不錯的標題。我已經嘗試了很多東西,但都沒有成功。我發現的唯一方法是指示如何改變計數器/文件擴展名是通過ie \ DeclareCaptionType [fileext = alg] {algorithm},但問題是這個命令已經定義了一個新的環境,所以我不知道如何使用它連同一個新的列表環境和標題包。我使用例如以下設置:
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox[cmyk]{0.43, 0.35, 0.35,0.01}{\parbox{\textwidth}{\hspace{15pt}#1#2#3}}}
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white, singlelinecheck=false, margin=0pt, font={bf,footnotesize}}
你可能有更多的運氣,詢問關於http://tex.stackexchange.com/你的問題 – Seamus 2010-10-10 17:48:57
好主意,我不知道這一次,謝謝! – fraktalek 2010-10-11 09:43:31