
簡単に検索しても答えが見つからなかったので、この質問を投稿します。
(サブサブ...)セクションのタイトルにスモールキャップを正しく表示する方法はありますか?
特に私の問題は次のコードにあります:
\documentclass{article}
\newcommand*{\matlab}{\textsc{matlab}}
\begin{document}
\section{\matlab}}
\end{document}
タイトルに小文字の MATLAB を生成する代わりに、通常のテキスト「matlab」、つまり\textsc{}
に入力されたものを生成しますnewcommand*{}{}
。
実際にはエラーや警告は生成されず、コンパイルされますが、必要な出力は得られません。
回避策/解決策を知っている人はいますか?
答え1
発見したのは、Computer Modern フォント ファミリには太字/小文字の太さ/形状の組み合わせがないということです。小文字の文字列の「通常の」太さを復元するには、その前にディレクティブを付ける必要があるのです\mdseries
。
\documentclass{article}
\newcommand*{\matlab}{\textsc{matlab}}
\newcommand*{\altmatlab}{{\mdseries\matlab}} % note the double pair of curly braces
%%% "\newcommand*{\altmatlab}{\textmd{\matlab}}" works too...
\begin{document}
\section{A title that contains ``\matlab'' as a string}
\section{A title that contains ``\altmatlab'' as a string}
\end{document}
Times Roman などの他のフォント ファミリでは、太字と小文字の組み合わせがサポートされています。これらのフォント ファミリのいずれかを使用する場合は、\matlab
セクション ヘッダーで基本マクロを使用しても問題ありません。
答え2
以下も可能です:
\documentclass{article}
\newcommand*\matlab{{\normalfont\textsc{matlab}}}
\begin{document}
\section{A title that contains ``\matlab'' as a string}
\end{document}