顯示帶有擊鍵包的命令鍵

顯示帶有擊鍵包的命令鍵

我正在嘗試編寫在 Macintosh 上用 LaTeX 打開終端機的說明。這需要我來說明按鍵,這是我用按鍵包解決的。不幸的是,我似乎找不到說明命令鍵的方法。我已經嘗試過\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}

輸出

相關內容