
気がついた図と表を組み合わせたリストですか?しかし、質問者は1つ図や表の番号付けスキームは、私が望んでいないものです。残念ながら、答えはその前提条件に依存しているようです。
私の質問は、次のような意図された結果/出力に関するものです:
図表一覧
図1: ニューオーリンズの樹木地図 .................................................... 3
図2: 1日あたりの葉の落ち葉数..................................5
表1: 樹木の種類 ............................................................................... 12
図3: 落ち葉1000枚あたりの空気質の低下.............. 20
これを機能させるには、上のリンクで提案されているように、図を表に再定義する (またはその逆) (つまり、 のようなもの\let\figure\table\let\endtable\endfigure
) ことは機能しません。当然、すべての図も「表 x」と呼ばれるようになるためです...
答え1
これは動作します。コードには適切にコメントされているため、これ以上のコメントは必要ないと思います。
\documentclass{article}
% To make the page shorter
\pagestyle{empty}
\textheight3in
% CODE STARTS HERE
% Based on `tocloft` package
\usepackage[titles]{tocloft}
\newlistof{figtab}{loft}{List of Figures and Tables}
\makeatletter
% Change the file extension of both lot and lof
\def\ext@figure{loft}
\def\ext@table{loft}
% Store the original `\thefigure` and `\thetable`
\let\tohe@thefigure\thefigure
\let\tohe@thetable\thetable
% Redefine them to contain a "dummy" `\tohe@list...`
\def\thefigure{\tohe@listfig\tohe@thefigure}
\def\thetable{\tohe@listtab\tohe@thetable}
% Make the two dummy commands truly dummy
\let\tohe@listfig\relax
\let\tohe@listtab\relax
% Store the original `\listoffigtab`
\let\tohe@listoffigtab\listoffigtab
% Redefine it in such a way that the dummy commands insert "Fig." or "Tab." respectively
\def\listoffigtab{%
\begingroup
\def\tohe@listfig{Fig.~}
\def\tohe@listtab{Tab.~}
\tohe@listoffigtab
\endgroup
}
% Change \listoffigtab spacing
\setlength{\cftfignumwidth}{5em}
\setlength{\cfttabnumwidth}{5em}
\setlength{\cftfigindent}{0pt}
\setlength{\cfttabindent}{0pt}
\makeatother
% CODE ENDS HERE
\begin{document}
\listoffigtab
% !b just to make the floats appear on the bottom of the first page
\begin{figure}[!b]
\caption{First}
\end{figure}
\begin{table}[!b]
\caption{Little Table}
\end{table}
\begin{figure}[!b]
\caption{Second}
\end{figure}
\end{document}
答え2
関連するコマンドは、「常に」です\addcontentsline
。
figure
キャプションは、拡張子がまたはtable
に保存されているファイルに書き込まれます。\ext@figure
\ext@table
\@caption
(実際には内部プロセッサ マクロでは) 次のようになります。
\long\def\@caption#1[#2]#3{%
\par
\addcontentsline{\csname ext@#1\endcsname}{#1}%
{\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
\begingroup
\@parboxrestore
\if@minipage
\@setminipage
\fi
\normalsize
\@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
\endgroup}
の最初のパラメータは\@caption
フロートの名前、つまりfigure
または(通常は) です。これを使用してパッチを適用し、キャプションを取得して拡張子 のファイルに保存することtable
ができます。table
redirect
\ext@figure
\documentclass{book}
\usepackage{caption}
\usepackage{xstring}
\usepackage{xpatch}
\makeatletter
\xpatchcmd{\@caption}{%
\addcontentsline{\csname ext@#1\endcsname}{#1}%
{\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
}{%
\IfStrEq{#1}{table}{% Filter `table` out
\addcontentsline{\csname ext@figure\endcsname}{table}%
{\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
}{%
\addcontentsline{\csname ext@#1\endcsname}{#1}%
{\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
}%
}{\typeout{Patch success}}{}
\makeatother
\renewcommand{\listfigurename}{List of Figures and Tables}
\begin{document}
\listoffigures
\begin{figure}
\caption{first figure}
\end{figure}
\begin{figure}
\caption{Another first figure}
\end{figure}
\begin{table}
\caption{first table}
\end{table}
\chapter{Another chapter}
\begin{table}
\caption{Yet another table}
\end{table}
\end{document}
yo'
LOFT 内の表なのか図なのか不明瞭であることに正しく気づいた後の小さな更新:
\documentclass{book}
\usepackage{caption}
\usepackage{xstring}
\usepackage{tocloft}
\usepackage{xpatch}
\addtolength{\cftfignumwidth}{30pt}
\addtolength{\cfttabnumwidth}{30pt}
% Prepend the tab or fig number with a `\makebox` (for equal width) and put `Tab.` or `Fig.` in there. Change the names at will
\renewcommand{\cfttabpresnum}{\makebox[30pt][l]{Tab.}}
\renewcommand{\cftfigpresnum}{\makebox[30pt][l]{Fig.}}
\makeatletter
\xpatchcmd{\@caption}{%
\addcontentsline{\csname ext@#1\endcsname}{#1}%
{\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
}{%
\IfStrEq{#1}{table}{%
\addcontentsline{\csname ext@figure\endcsname}{table}%
{\protect\numberline{\csname the#1\endcsname\hfill\hspace{1em}}{\ignorespaces #2}}%
}{%
\IfStrEq{#1}{figure}{%
\addcontentsline{\csname ext@#1\endcsname}{#1}%
{\protect\numberline{\csname the#1\endcsname\hfill\hspace{1em}}{\ignorespaces #2}}%
}{%
\addcontentsline{\csname ext@#1\endcsname}{#1}%
{\protect\numberline{\csname the#1\endcsname}{ \ignorespaces #2}}%
}
}%
}{\typeout{Patch success}}{}
\makeatother
\renewcommand{\listfigurename}{List of Figures and Tables}
\begin{document}
\listoffigures
\begin{figure}
\caption{first figure}
\end{figure}
\begin{figure}
\caption{Another first figure}
\end{figure}
\begin{table}
\caption{first table}
\end{table}
\chapter{Another chapter}
\begin{table}
\caption{Yet another table}
\end{table}
\section{First section}
\subsection{First subsection}
\subsubsection{First subsubsection}
\begin{table}
\caption{Yet another another table}
\end{table}
\end{document}