Display command key with keystroke package
By default, the keystroke
package only defines
\Enter \Del \Ins \Esc \Shift \Ctrl \Home
\End \PgUp \PgDown \PrtSc \Scroll \Break
(with localized versions for other languages than English). You can add to the list yourself.
\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}
Here's a solution using menukeys
. Btw: Believing the example file for the package keystroke
there is no Mac command key in that package.
\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}
The \keystroke
command from the keystroke
package takes in any argument like a
, Z
, F1
etc. It even takes in graphics as an input argument, so that's what I used:
\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}