对齐图表标题和页码

对齐图表标题和页码

作为 LaTeX 的新用户,我在对齐图表标题和其对应的页码时遇到了挑战。如果 LaTeX 社区能够提供一些关于如何解决此问题的指导,我将不胜感激。我使用以下代码:

 \documentclass[12pt,a4paper]{memoir}
\usepackage{xcolor,framed,titletoc,lmodern}

\definecolor{myred}{RGB}{127,0,0}
\definecolor{myyellow}{RGB}{169,121,69}

\renewenvironment{leftbar}{%
    \def\FrameCommand{%
        \hspace{6em}%
        {\color{myyellow}\vrule width 2pt depth 6pt}%
        \hspace{1em}%
    }%
    \MakeFramed{\parshape 1 0cm \dimexpr\textwidth-6em\relax\FrameRestore}\vskip2pt\relax
}
{\endMakeFramed}

\titlecontents{chapter}
[0em]{\vspace*{2\baselineskip}}
{\parbox{4.5em}{%
        \hfill\Huge\sffamily\bfseries\color{myred}\thecontentspage}%
    \vspace*{-2.3\baselineskip}\leftbar
    \textsc{\small\chaptername~\thecontentslabel}\\\sffamily}

{}{\endleftbar}



\titlecontents{section}
[8.4em]
{\sffamily\contentslabel{3em}}{}{}
{\hspace{0.5em}\nobreak\itshape\color{myred}\contentspage}
\titlecontents{subsection}
[8.4em]
{\sffamily\contentslabel{3em}}{}{}  
{\hspace{0.5em}\nobreak\itshape\color{myred}\contentspage}




\titlecontents{figure}
[0em]{\vspace*{0.5\baselineskip}}
{\parbox{4.5em}{%
        \hfill\Huge\sffamily\bfseries\color{myred}\thecontentspage}%
    \vspace*{-2.3\baselineskip}\leftbar
    \textsc{\small Figure~\thecontentslabel}\\\sffamily}
{}{\endleftbar}



\titlecontents{table}
[0em]{\vspace*{0.5\baselineskip}}
{\parbox{4.5em}{%
        \hfill\Huge\sffamily\bfseries\color{myred}\thecontentspage}%
    \vspace*{-2.3\baselineskip}\leftbar
    \textsc{\small Table~\thecontentslabel}\\\sffamily}
{}{\endleftbar}


\newcommand*\updatemylof{%
    \addtocontents{lof}{\protect\section*{Chapter~\thechapter}}%
}

结果 :

在此处输入图片描述

我想修改此代码以确保图形标题和页码显示在同一行,

相关内容