I am struggling to represent the "Shift" key. This is my best attempt so far:

\documentclass{article}

\usepackage{keystroke}
\usepackage[arrows]{boisik}

\begin{document}
Current solution: \keystroke{$\upwhitearrow$ Shift}
\end{document}

Current solution

I'm still not happy with the result as the up arrow is quite different from that of a real keyboard:

Real shift key

I also tried to find a more similar up arrow using Detexify to no avail:

Detexify

How could I get a more realistic representation of the "Shift" key? (I'm using pdfLaTex.)

  • 2
    I suppose the \Shift macro is not close enough to the arrow you want? – samcarter Oct 15 at 23:35
  • @samcarter :Thank you for your suggestion, I was not aware of the existence of the \Shift macro. But my current solution is closer to the desired result than yours. – Tonechas Oct 15 at 23:56
  • Anyway if you want to use this key often, it might be better to redefine the definition of \Shift with whatever solution you choose (hint: only the duck is a valid choice :). – samcarter Oct 16 at 0:08
  • 2
    The one on my keyboard here looks much more like \uparrow -- there's quite a lot of variety – Chris H Oct 16 at 13:10
  • Thank you Fran, TeXnician and marmot for your suggestions. All the approaches you proposed are fine, but in order to close this question I have to accept one answer, and the winner is... @marmot! as his/her solution is the one which best fit my needs (although using TikZ for this is admittedly a bit of overkill). – Tonechas Oct 19 at 12:18
up vote 14 down vote accepted

For just this purpose this will be an overkill, but if you have many keyboards that you wish to recreate, it might be worthwhile considering using TikZ.

\documentclass{article}

\usepackage{keystroke}
\usepackage[arrows]{boisik}
\usepackage{tikz}
\usetikzlibrary{shapes.arrows,positioning}

\begin{document}
Current solution: \keystroke{$\upwhitearrow$ Shift}

Alternative solution: \keystroke{\tikz{%
\node[single arrow,draw,shape border rotate=90,scale=0.3,minimum height=20pt](arrow){};
\node[right=5pt of arrow,font=\sffamily,inner sep=0pt](shift){Shift};
\path(shift.north)--++(0,2pt);}}

\end{document}

enter image description here

Why would one do this? This is IMHO the easiest way to also get the duck key. ;-)

\documentclass{article}

\usepackage{keystroke}
\usepackage{tikzducks}
\usetikzlibrary{positioning}

\begin{document}
\keystroke{\tikz{%
\begin{scope}[scale=0.15,local bounding box=duck]
\duck
\end{scope}
\node[right=5pt of duck,yshift=1pt,font=\sffamily,inner sep=0pt](shift) {duck};
\path(shift.north)--++(0,2pt);}}

\end{document}

enter image description here

  • 2
    Where can I get a keyboard with this key????? – samcarter Oct 16 at 0:00
  • 2
    @samcarter Are you kidding me? Are you implying your keyboard does not have this key? So you really type \ d u c k just to get a duck? ;-) – marmot Oct 16 at 0:02
  • Unfortunately yes - I have to deal with an inferior model that aims at input for humans. It has neither a duck nor a marmot key! – samcarter Oct 16 at 0:04
  • @samcarter Oh no! That's a scandal. You should seriously consider suing the seller. – marmot Oct 16 at 0:05
  • Or I should complain with the people from worker protection - there must be regulations against this! – samcarter Oct 16 at 0:06

Just as alternative a package-based approach (menukeys) which looks slightly different.

menu keys

\documentclass{article}
\usepackage{menukeys}

\begin{document}
\keys{\shift\ Shift}
\end{document}

As there are already solutions with keystrokes, menukeys and ducks, I will try with tcolorbox. Bonus: the key is clickable.

mwe

\documentclass{article}
\usepackage[colorlinks]{hyperref}
\usepackage[most]{tcolorbox}
\usetikzlibrary{shadings}
\tcbuselibrary{skins}
\usepackage{wasysym}

\def\shift{\tcbox[beamer, on line, size=small,
toprule=.5pt, bottomrule=2pt, leftrule=.6pt, rightrule=1.5pt,
hyperref=sec:Shift,
frame style={upper left=yellow!40!black!40,
lower left=cyan!05!black!85,
upper right=yellow!10!black!70,
lower right=red!05!black},colupper=green!10!white,
colback=black!65]{\sffamily\rotatebox{90}{\Large\pointer} Shift
} }

\begin{document}
See the \shift section. 
\newpage
\section*{The shift key}
\label{sec:Shift}
This is the text about the Shift key
\end{document}

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.