그림 목록, 테이블 목록 등의 각 항목 앞의 공백을 제거하려고 합니다.
내가하고 싶은 일은 다음과 같습니다.
내 MWE는 다음과 같습니다.
\documentclass[11pt, a4paper, dvipsnames, openany, twoside]{book}
%-------------------------------------------------------------------
% Packages
%-------------------------------------------------------------------
\usepackage[francais]{babel}
\usepackage{caption}
\usepackage{etoolbox}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{lipsum}
\usepackage[most]{tcolorbox}
\usepackage{tikz}
\usepackage{tocbasic}
%\usepackage[nottoc, notlof, notlot]{tocbibind}
\usepackage{xcolor}
%-------------------------------------------------------------------
% Structure
%-------------------------------------------------------------------
% Color
\colorlet{maincolor}{Red}
% Lists : settings
% Set "listof" as sections and not as chapters
\addtotoclist[float]{lof}
\renewcommand*\listoffigures{\listoftoc[{\listfigurename}]{lof}}
\addtotoclist[float]{lot}
\renewcommand*\listoftables{\listoftoc[{\listtablename}]{lot}}
\makeatletter
\doforeachtocfile[float]{\setuptoc{\@currext}{leveldown}}
\makeatother
\renewcommand{\numberline}[1]{#1~--~}
\renewcommand{\thefigure}{Figure~\arabic{chapter}.\arabic{figure}}
\renewcommand{\thetable}{Tableau~\arabic{chapter}.\arabic{table}}
\renewcommand\frenchtablename{}
\renewcommand{\frenchlistfigurename}{Liste des figures}
% Figure
\newcommand{\myfigure}[2][]{\ifstrempty{#1}{\tcbincludegraphics{#2}}{\tcbincludegraphics[arc=8pt, width=7cm, colframe=maincolor, step and label={figure}{fig:#1}, title=\textbf{\thefigure~--~{#1}}, phantom={\addcontentsline{lof}{section}{\protect\numberline{\thefigure}{#1}}},]{#2}}}
%-------------------------------------------------------------------
% Beginning of document
%-------------------------------------------------------------------
\begin{document}
\chapter*{Table des illustrations}
\listoffigures
\listoftables
\chapter{Illustrations diverses}
\section{Première section}
\lipsum[1]
\myfigure[Figure test]{example-image-b}
\end{document}
답변1
이미 KOMA-Script 패키지를 사용하고 있습니다 tocbasic
. 따라서 \DeclareTOCStyleEntry
및 속성을 사용하여 항목의 들여쓰기를 변경할 수 있습니다 indent
. 그러나 코드의 문제는 . section
대신 그림에 대한 항목을 사용한다는 것입니다 figure
. 그래서 이것도 바꿔야 합니다.
\documentclass[11pt, a4paper, dvipsnames, openany, twoside]{book}
%-------------------------------------------------------------------
% Packages
%-------------------------------------------------------------------
\usepackage[francais]{babel}
\usepackage{caption}
\usepackage{etoolbox}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{lipsum}
\usepackage[most]{tcolorbox}
\usepackage{tikz}
\usepackage{tocbasic}
%\usepackage[nottoc, notlof, notlot]{tocbibind}
\usepackage{xcolor}
%-------------------------------------------------------------------
% Structure
%-------------------------------------------------------------------
% Color
\colorlet{maincolor}{Red}
% Lists : settings
% Set "listof" as sections and not as chapters
\addtotoclist[float]{lof}
\renewcommand*\listoffigures{\listoftoc[{\listfigurename}]{lof}}
\addtotoclist[float]{lot}
\renewcommand*\listoftables{\listoftoc[{\listtablename}]{lot}}
\makeatletter
\doforeachtocfile[float]{\setuptoc{\@currext}{leveldown}}
\makeatother
\renewcommand{\numberline}[1]{#1~--~}
\renewcommand{\thefigure}{Figure~\arabic{chapter}.\arabic{figure}}
\renewcommand{\thetable}{Tableau~\arabic{chapter}.\arabic{table}}
\renewcommand\frenchtablename{}
\renewcommand{\frenchlistfigurename}{Liste des figures}
% Figure
\newcommand{\myfigure}[2][]{\ifstrempty{#1}{\tcbincludegraphics{#2}}{\tcbincludegraphics[arc=8pt,
width=7cm, colframe=maincolor, step and label={figure}{fig:#1},
title=\textbf{\thefigure~--~{#1}},
phantom={\addcontentsline{lof}
{figure}% CHANGED
{\protect\numberline{\thefigure}{#1}}},]{#2}}}
\newcommand*{\numberwithhyphen}[1]{#1~--~}% ADDED (You could use this also to add `\figurename` before the number, if you'd also adapt numwidth attribute.)
\DeclareTOCStyleEntry[indent=0pt,numwidth=5.5em,entrynumberformat=\numberwithhyphen]{tocline}{figure}% ADDED
%-------------------------------------------------------------------
% Beginning of document
%-------------------------------------------------------------------
\begin{document}
\chapter*{Table des illustrations}
\listoffigures
\listoftables
\chapter{Illustrations diverses}
\section{Première section}
\lipsum[1]
\myfigure[Figure test]{example-image-b}
\end{document}
에 대한 자세한 내용은 KOMA-Script 매뉴얼을 참조하세요 \DeclareTOCStyleEntry
.
BTW: tocbasic
와 같은 문자열을 항목 앞에 붙이는 기능도 제공합니다 Figure
. 따라서 의 다른 사용에 문제가 발생하는 경우 이를 추가할 \thefigure
필요가 없습니다 \thefigure
.
답변2
여기에서 패키지가 없는 깨끗한 솔루션을 찾았습니다.
\makeatletter
\renewcommand*\l@figure{\@dottedtocline{1}{0em}{2.3em}}% Default: 1.5em/2.3em
\let\l@table\l@figure
\makeatother