我正在使用 keystroke 包来创建键盘图标。但是,其中几个项目没有居中对齐。例如,单个数字全部右对齐,这让按钮看起来很奇怪。我该如何解决这个问题?
梅威瑟:
\documentclass[12pt]{report}
\usepackage{keystroke}
\begin{document}
\begin{itemize}
\item \keystroke{0},\keystroke{1} ...\keystroke{9}: The digits 0 through to 9.
\item \keystroke{+}: Addition
\item \keystroke{$-$}: Subtraction
\item \keystroke{$*$}: Multiplication
\item \keystroke{$/$}: Division
\end{itemize}
\end{document}
答案1
尝试这个:
\documentclass[12pt]{report}
\usepackage{keystroke}
\usepackage{xpatch}
\makeatletter
\xpatchcmd\suse@keystr@ke
{\hbox to 0pt{\unhbox\suse@key\hss}}
% \suse@key = \hbox{{\keystroke@font\strut#1}}
% \@tempdimb = max(\wd\suse@key, \dp\suse@key)
{\hbox to 0pt{\hbox to \@tempdimb{\hss\unhbox\suse@key\hss}\hss}}
{}{\PatchFailed}
\makeatother
\begin{document}
\begin{itemize}
\item \keystroke{0},\keystroke{1} ...\keystroke{9}: The digits 0 through to 9.
\item \keystroke{+}: Addition
\item \keystroke{$-$}: Subtraction
\item \keystroke{$*$}: Multiplication
\item \keystroke{$/$}: Division
\end{itemize}
\end{document}
答案2
这段代码很棘手,但是有效!
\documentclass[12pt]{report}
\usepackage{keystroke}
\begin{document}
\begin{itemize}
\item \keystroke{\,0},\keystroke{\,1} ...\keystroke{\,9}: The digits 0 through to 9.
\item \keystroke{+}: Addition
\item \keystroke{$-$}: Subtraction
\item \keystroke{$\,*$}: Multiplication
\item \keystroke{$\,/$}: Division
\end{itemize}
\end{document}
或者,您必须在包实现中做出一些编辑。