使用按键包显示命令键

使用按键包显示命令键

我正在尝试编写在 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等。它甚至接受图形作为输入参数,所以我使用了它:ZF1

\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}

输出

相关内容