如何使书的标题与页脚右对齐?

如何使书的标题与页脚右对齐?
\documentclass[twoside,11pt]{book}
\usepackage{fancyhdr,xcolor,lipsum}
\let\Chaptermark\chaptermark
\def\chaptermark#1{\def\Chaptername{#1}\Chaptermark{#1}}
\fancyhead{}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot{}
\colorlet{myfancycolor}{black}
\fancypagestyle{mystyle}{
    \renewcommand*\footrulewidth{1pt}
    \fancyfoot[OR]{%
        \kern-3ex % all material is shifted up by 3ex
        \color{myfancycolor}
        \hrule height1pt % your \hrule
        \hfil
        \hbox{\rlap{\vrule height1.3em width2em depth.7em}% you black box
            \hbox to2em{\hss\color{white}{\textsf{\thepage}}\hss}}%
    }
    \fancyfoot[OL]{%
        \Chaptername
    }    
    \fancyfoot[EL]{%
        \kern-3ex % all material is shifted up by 3ex
        \color{myfancycolor}
        \hrule height1pt % your \hrule
        \hbox{\rlap{\vrule height1.3em width2em depth.7em}% you black box
            \hbox to2em{\hss\color{white}{\textsf{\thepage}}\hss}}%
    }
    \fancyfoot[ER]{%
        \rightmark{ 
            \footnotesize\textbf{INTRODUCTION TO MATLAB}
        }
    }
}
\pagestyle{mystyle}
\begin{document}
    \frontmatter
    \chapter{PREFACE}
    \lipsum[1-2]
    \tableofcontents
    \mainmatter
    \chapter{LALALA LALALA LALALA}
    \lipsum[1-8]
\end{document}

在此处输入图片描述

我想在每个偶数页的页脚上显示标题书。但是为什么上面的代码标题书无法右对齐(标题书和右边距之间有空格)?如何使标题书在页脚中右对齐?

相关内容