我正在尝试编写在 Macintosh 上用 LaTeX 打开终端的说明。这需要我演示按键,这是我使用 keystroke 包解决的问题。不幸的是,我似乎找不到演示 Command 键的方法。我尝试了 和\Command
。\Cmd
我该怎么做才能显示 Command 键?
\documentclass{book}
\usepackage{keystroke}
\title{Install Homebrew on A Macintosh}
\begin{document}
\maketitle
\subsection{Homebrew}
First, install the \href{https://brew.sh}{homebrew package manager for OS X} by simply pasting the ruby script on their website into your terminal emulator. You can open your terminal emulator by pressing \Cmd + \Spacebar
\end{document}
答案1
默认情况下,keystroke
包仅定义
\Enter \Del \Ins \Esc \Shift \Ctrl \Home
\End \PgUp \PgDown \PrtSc \Scroll \Break
(提供除英语之外的其他语言的本地化版本)。您可以自行添加到列表中。
\documentclass{book}
\usepackage{keystroke}
\usepackage{hyperref}
\newcommand*{\Cmd}{\keystroke{Cmd}}
\title{Install Homebrew on A Macintosh}
\author{Miles}
\begin{document}
\maketitle
\subsection{Homebrew}
First, install the \href{https://brew.sh}{homebrew package manager for OS X}
by simply pasting the ruby script on their website into your terminal emulator.
You can open your terminal emulator by pressing \Cmd + \Spacebar
\end{document}
答案2
这是一个使用的解决方案menukeys
。顺便说一句:相信包的示例文件keystroke
该包中没有 Mac 命令键。
\documentclass{article}
\usepackage[os=mac]{menukeys}
\begin{document}
\subsection{Homebrew}
First, install the \dots\ by simply pasting the ruby script on their website into your terminal emulator. You can open your terminal emulator by pressing \keys{\cmd+\Space}
\end{document}
答案3
\keystroke
包中的命令接受keystroke
任何参数,如、a
等。它甚至接受图形作为输入参数,所以我使用了它:Z
F1
\documentclass{book}
\usepackage{keystroke}
\usepackage{graphicx}
\usepackage{scalerel}
\def\cmd{%
\scalerel*{\includegraphics{apple}}{X}%
}
\begin{document}
\subsection{Homebrew}
First, install the homebrew package manager for OS X by simply pasting the ruby script on their website into your terminal emulator. You can open your terminal emulator by pressing \keystroke{\cmd}+\Spacebar
\end{document}