我已经定义了一个 mdframed 环境,如下面的 MWE 所示。我希望框架标题中的“Box”采用小写字母。我该如何实现?
\documentclass[a4paper,11pt,oneside,openany,showtrims,strict,extrafontsizes]{memoir}
\newcounter{infobox}[chapter]
\renewcommand{\theinfobox}{\thechapter.\arabic{infobox}}
\usepackage[skipabove=25pt,skipbelow=25pt,leftmargin=10pt,rightmargin=10pt,framemethod=TikZ]{mdframed}
\usepackage{lipsum}
\newenvironment{infobox}[1][]{%
\refstepcounter{infobox}%
\begin{mdframed}[%
frametitle={Box \theinfobox\ #1},
skipabove=\baselineskip plus 2pt minus 1pt,
skipbelow=\baselineskip plus 2pt minus 1pt,
linewidth=0.5pt,
frametitlerule=true,
repeatframetitle=true,
font=\small,
]%
\addcontentsline{lob}{section}{\numberline{\theinfobox}#1}%
}{%
\end{mdframed}
}
\makeatletter
\newcommand\listboxname{Boxes}
\newcommand\listofboxes{
\chapter*{\listboxname}
\@starttoc{lob}
}
\makeatother
\begin{document}
\tableofcontents
\newpage
\listoffigures
\listofboxes
\chapter{Chapter one starts here}
\section{Heading}
\lipsum[4]
\begin{infobox}[Title of the first test box]
\label{orgspecialblock1}
\lipsum[4]
\end{infobox}
\begin{infobox}[Title of the second test box]
\label{orgspecialblock2}
\lipsum[4]
\end{infobox}
\begin{figure}
\caption{\label{orgspecialblock3}ksfkhjsdkjhfs}
\includegraphics[width=0.9\linewidth]{pou.png}
\end{figure}
\chapter{Chapter two starts here}
\section{Heading}
\lipsum[4]
\begin{infobox}[Title of the third test box]
\label{orgspecialblock1}
\lipsum[4]
\end{infobox}
\begin{infobox}[Title of the fourth test box]
\label{orgspecialblock2}
\lipsum[4]
\end{infobox}
\end{document}
答案1
默认的 OT1 编码字体没有小写版本。您的日志文件应显示以下警告:
LaTeX Font Warning: Font shape `OT1/cmr/bx/sc' undefined
(Font) using `OT1/cmr/bx/n' instead
添加:
\usepackage[T1]{fontenc}
然后只需\textsc{Box}
在您的框标题中使用即可。