
내 그림 목록에서 내 하위 그림 앞에 "그림"이라는 단어를 붙이고 싶지 않습니다. 또한 내 그림 목록과 목록에서 "SuperTest" 그림의 "S" 바로 아래에 하위 그림의 번호를 대괄호("a" 대신 "(a)")로 묶고 싶습니다. 수치.
미리 감사드립니다!
내 MWE는 다음과 같습니다.
\documentclass[11pt]{article}
\usepackage{blindtext,tabularx,graphicx}
\usepackage[margin=1in]{geometry}
\usepackage[list=true]{subcaption}
\usepackage[labelfont=bf,labelsep=period]{caption}
\usepackage{tocloft}
\captionsetup[subfigure]{skip=8pt,position=bottom,font=bf}
\captionsetup[table]{font=bf}
\captionsetup[figure]{labelfont=bf}
%%%%%%%%%%%% ToC, LoF, LoT ADJUSTMENTS %%%%%%%%%%%%%%%%%%%%
% Formatting ToC
% Adjust spacing between number and title in ToC
% Adjust dots in ToC, LoF, LoT
\renewcommand\cftdotsep{1}
\makeatletter
\renewcommand{\@dotsep}{1}
\makeatother
\setlength{\cftfigindent}{0pt} % remove indentation from figures in lof
\setlength{\cfttabindent}{0pt} % remove indentation from tables in lot
% Formatting LoF
\setcounter{lofdepth}{2}
\cftpagenumbersoff{subfigure}
\makeatletter
\renewcommand\cftfigfont{\bfseries}
\makeatother
\makeatletter
\newcommand\cftsubtabdotsep{\cftdotsep}
\newcommand\cftsubfigfont{\normalfont}
\newcommand\cftsubfigpresnum{}
\newcommand\cftsubfigaftersnum{}
\newcommand\cftsubfigaftersnumb{}
\newcommand\cftsubfigleader{\hfill}
\newcommand\cftsubfigpagefont{\normalfont}
\newcommand\cftsubfigafterpnum{}
\providecommand{\toclevel@subfigure}{1}
\renewcommand*\l@subfigure[2]{%
\ifnum \c@lofdepth > \toclevel@subfigure
\vskip \cftbeforesubfigskip
{\leftskip \cftsubfigindent\relax
\rightskip \@tocrmarg
\parfillskip -\rightskip
\parindent \cftsubfigindent\relax\@afterindenttrue
\interlinepenalty\@M
\leavevmode
\@tempdima \cftsubfignumwidth\relax
\let\@cftbsnum \cftsubfigpresnum
\let\@cftasnum \cftsubfigaftersnum
\let\@cftasnumb \cftsubfigaftersnumb
\advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
{\cftsubfigfont #1}\nobreak
\cftsubfigfillnum{#2}}%
\fi
}%
\newlength\cftbeforesubfigskip
\setlength\cftbeforesubfigskip{\z@ \@plus.2\p@}
\newlength\cftsubfigindent
\setlength\cftsubfigindent{3.8em}
\newlength\cftsubfignumwidth
\setlength\cftsubfignumwidth{2.5em}
\renewcommand{\cftsubfigfillnum}[1]{%
{\cftsubfigleader\hfill}\par
}
\makeatother
% Formatting LoT
\setcounter{lotdepth}{1}
\makeatletter
\renewcommand\cfttabfont{\bfseries}
\makeatother
\begin{document}
\tableofcontents
\clearpage
{%
\let\oldnumberline\numberline%
\renewcommand{\numberline}{\figurename~\oldnumberline}%
\listoffigures%
}
%\listoffigures
\addcontentsline{toc}{section}{List of Figures}
\clearpage
{%
\let\oldnumberline\numberline%
\renewcommand{\numberline}{\tablename~\oldnumberline}%
\listoftables
}
\addcontentsline{toc}{section}{List of Tables}
\clearpage
\section{Nice0}
\begin{figure}[htb] \label{figure:Test}
\centering
\includegraphics[width=\textwidth]{example-image}
\captionsetup[subfigure]{skip=8pt,position=bottom}
\parbox{0.5\textwidth}{\subcaption[Test]{Test}}\hfill
\parbox{0.5\textwidth}{\subcaption[Test2]{Test2}}
\caption[SuperTest]{{\bf Test} \\Histogram of (a) Test and (b) most common Test sample.}
\end{figure}
\clearpage
\section{Nice1}
\begin{table}[htbp]\label{table:Test}
\caption[Test]{Test} \blindtext
\begin{center}
\begin{tabular}{|l||c|c|} \hline\hline
Ice Cream Store & Location & How to Get There \\ \hline
Toscanini’s & Central Square & Just walk! \\
Herrell’s & Harvard Square & Red Line \\
J.P. Licks & Davis Square & Red Line \\
Ben \& Jerry’s & Newbury Street & Green Line \\ \hline\hline
\end{tabular}
\end{center}
\end{table}
\end{document}
답변1
하위 그림 문자 주위의 괄호에 대해 다음을 사용하여 자신만의 목록 형식을 정의할 수 있습니다.
\DeclareCaptionListFormat{myListFormat}{(#2)}
다음과 같은 하위 캡션 패키지를 정의하는 데 사용합니다.
\usepackage[list=true, listformat=myListFormat]{subcaption}
하위 그림 앞에 "그림" 접두사가 붙는 것을 원하지 않으면 부품을 교체해야 합니다.
\let\oldnumberline\numberline%
\renewcommand{\numberline}{\figurename~\oldnumberline}%
귀하의 코드
\renewcommand{\cftfigpresnum}{Figure~}
\setlength{\cftfignumwidth}{5em}
완전히 작동하는 수정된 코드 예제를 추가했습니다.
\documentclass[11pt]{article}
\usepackage{blindtext,tabularx,graphicx}
\usepackage[margin=1in]{geometry}
\usepackage[labelfont=bf,labelsep=period]{caption}
\DeclareCaptionListFormat{myListFormat}{(#2)}
\usepackage[list=true, listformat=myListFormat]{subcaption}
\usepackage{tocloft}
\captionsetup[subfigure]{skip=8pt,position=bottom,font=bf}
\captionsetup[table]{font=bf}
\captionsetup[figure]{labelfont=bf}
%%%%%%%%%%%% ToC, LoF, LoT ADJUSTMENTS %%%%%%%%%%%%%%%%%%%%
% Formatting ToC
% Adjust spacing between number and title in ToC
% Adjust dots in ToC, LoF, LoT
\renewcommand\cftdotsep{1}
\makeatletter
\renewcommand{\@dotsep}{1}
\makeatother
\setlength{\cftfigindent}{0pt} % remove indentation from figures in lof
\setlength{\cfttabindent}{0pt} % remove indentation from tables in lot
% Formatting LoF
\setcounter{lofdepth}{2}
\cftpagenumbersoff{subfigure}
\makeatletter
\renewcommand\cftfigfont{\bfseries}
\makeatother
\makeatletter
\newcommand\cftsubtabdotsep{\cftdotsep}
\newcommand\cftsubfigfont{\normalfont}
\newcommand\cftsubfigpresnum{}
\newcommand\cftsubfigaftersnum{}
\newcommand\cftsubfigaftersnumb{}
\newcommand\cftsubfigleader{\hfill}
\newcommand\cftsubfigpagefont{\normalfont}
\newcommand\cftsubfigafterpnum{}
\providecommand{\toclevel@subfigure}{1}
\renewcommand*\l@subfigure[2]{%
\ifnum \c@lofdepth > \toclevel@subfigure
\vskip \cftbeforesubfigskip
{\leftskip \cftsubfigindent\relax
\rightskip \@tocrmarg
\parfillskip -\rightskip
\parindent \cftsubfigindent\relax\@afterindenttrue
\interlinepenalty\@M
\leavevmode
\@tempdima \cftsubfignumwidth\relax
\let\@cftbsnum \cftsubfigpresnum
\let\@cftasnum \cftsubfigaftersnum
\let\@cftasnumb \cftsubfigaftersnumb
\advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
{\cftsubfigfont #1}\nobreak
\cftsubfigfillnum{#2}}%
\fi
}%
\newlength\cftbeforesubfigskip
\setlength\cftbeforesubfigskip{\z@ \@plus.2\p@}
\newlength\cftsubfigindent
\setlength\cftsubfigindent{3.8em}
\newlength\cftsubfignumwidth
\setlength\cftsubfignumwidth{2.5em}
\renewcommand{\cftsubfigfillnum}[1]{%
{\cftsubfigleader\hfill}\par
}
\makeatother
% Formatting LoT
\setcounter{lotdepth}{1}
\makeatletter
\renewcommand\cfttabfont{\bfseries}
\makeatother
\begin{document}
\tableofcontents
\clearpage
{%
\renewcommand{\cftfigpresnum}{Figure~}
\setlength{\cftfignumwidth}{5em}
\listoffigures%
}
%\listoffigures
\addcontentsline{toc}{section}{List of Figures}
\clearpage
{%
\let\oldnumberline\numberline%
\renewcommand{\numberline}{\tablename~\oldnumberline}%
\listoftables
}
\addcontentsline{toc}{section}{List of Tables}
\clearpage
\section{Nice0}
\begin{figure}[htb] \label{figure:Test}
\centering
\includegraphics[width=\textwidth]{example-image}
\captionsetup[subfigure]{skip=8pt,position=bottom}
\parbox{0.5\textwidth}{\subcaption[Test]{Test}}\hfill
\parbox{0.5\textwidth}{\subcaption[Test2]{Test2}}
\caption[SuperTest]{{\bf Test} \\Histogram of (a) Test and (b) most common Test sample.}
\end{figure}
\clearpage
\section{Nice1}
\begin{table}[htbp]\label{table:Test}
\caption[Test]{Test} \blindtext
\begin{center}
\begin{tabular}{|l||c|c|} \hline\hline
Ice Cream Store & Location & How to Get There \\ \hline
Toscanini’s & Central Square & Just walk! \\
Herrell’s & Harvard Square & Red Line \\
J.P. Licks & Davis Square & Red Line \\
Ben \& Jerry’s & Newbury Street & Green Line \\ \hline\hline
\end{tabular}
\end{center}
\end{table}
\end{document}