Tran Le Nam
Please help me draw two kinds of calculator keyboards as the below figure. How is it used for LaTeX code?
Many thanks!

Top Answer
samcarter
There are several packages which provide calculator keys, for example the [`tipfr` package](https://www.ctan.org/pkg/tipfr) which
```
\documentclass{article}
\usepackage{tipfr}
\begin{document}
\centering
\Touche[principal={on}]
\hrule
\Touche[principal={shift}] \Touche[principal={on}]
\hrule
\Touche[style=number, principal=0]
\Touche[style=number, principal=1]
\Touche[style=number, principal=2]
\Touche[style=number, principal=3]
\Touche[style=number, principal=4]
\Touche[style=number, principal=5]
\Touche[style=number, principal=6]
\Touche[style=number, principal=7]
\Touche[style=number, principal=8]
\Touche[style=number, principal=9]
\end{document}
```

Or if you prefer a more Casio-like look, you could use the [`graph35` package](https://ctan.org/pkg/graph35)
```
\documentclass{article}
\usepackage[
%color=blackandwhite
]{graph35}
\begin{document}
\centering
\key{ACON}
\key{SHIFT}\key{ACON}
\key{zero}\key{1}\key{2}\key{3}
\key{4}\key{5}\key{6}\key{7}
\key{8}\key{9}
\end{document}
```

Or you could use `tikz` and give the buttons whatever look you want:
```
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shadows,shapes.geometric}
\newcommand{\key}[2][]{\begin{tikzpicture}
\node[shade,top color=black, bottom color=gray!90!black,text=white,minimum width=3em,minimum height=2em,drop shadow,rounded corners,font=\sffamily,#1] at (0,0) {#2};
\end{tikzpicture}}
\begin{document}
\centering
\key[ellipse]{ON}
\key[ellipse]{ON}
\key[ellipse]{SHIFT}
\key{0}
\key{1}
\key{2}
\key{3}
\key{4}
\key{5}
\key{6}
\key{7}
\key{8}
\key{9}
\end{document}
```

```
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shadows,shapes.geometric}
\newcommand{\key}[2][]{\begin{tikzpicture}
\node[shade,ball color=black,text=white,minimum width=3em,minimum height=2em,drop shadow,rounded corners,font=\sffamily,#1] at (0,0) {#2};
\end{tikzpicture}}
\begin{document}
\centering
\key[ellipse]{ON}
\key[ellipse]{ON}
\key[ellipse]{SHIFT}
\key{0}
\key{1}
\key{2}
\key{3}
\key{4}
\key{5}
\key{6}
\key{7}
\key{8}
\key{9}
\end{document}
```

Answer #2
Skillmon
An option missing from [@samcarter's wonderful answer](https://topanswers.xyz/tex?q=1872#a2102) is `menukeys`[^1].
Though originally written for computer keyboards (and so there are a few special key names like `\shift` and so on). Placement would have to be done by some other means (~~either via Ti*k*Z~~[^2] or via `tabular`s):
```
\documentclass[]{article}
\usepackage{menukeys}
\usetikzlibrary{shapes.geometric}
% change the used style for the keys to have a shadow and the delimiter
% character between multiple keys for key combinations (the package default is
% `+` which seems unhandy for calculator keys).
\renewmenumacro\keys[;]{shadowedroundedkeys}
\newmenustylesimple{shadowedovalkeys}
{% set the TikZ style which should be applied for each key
tw@set@tikz@colors, % evil menukeys-internal key
,minimum width=2em
,font=\relsize{-1}\sffamily
,general shadow=%
{shadow xshift=.2ex, shadow yshift=-.15ex, fill=\usemenucolor{c}}
,ellipse
,inner ysep=0pt
}
[% set the separator between multiple keys
\hspace{0.2ex}\hspace{0.1em plus 0.1em minus 0.05em}%
\textcolor{\usemenucolor{b}}{\raisebox{0.25ex}{\sffamily\relsize{-2}+}}%
\hspace{0.1em plus 0.1em minus 0.05em}%
]
{gray}
\newmenumacro\okeys[;]{shadowedovalkeys}
\usepackage{collcell} % will also load `array`
\usepackage{expkv-cs}
% define a new column type which typesets the column contents using the `\keys`
% macro. The column type will be called `k` and accept an optional argument
% which has a small key value interface (powered by expkv-cs so we don't have to
% add some expansion chain here to get the column type)
\newcolumntype{k}[1]{}
\makeatletter
\ekvcSplit\keys@col@parse
{
type=\keys
,align=c
}
{%
\@temptokena\expandafter
{\the\@temptokena>{\let\keys@col@#1\collectcell\keys@col}#2<{\endcollectcell}}%
}
\ekvcSecondaryKeys\keys@col@parse
{%
nmeta oval=type=\okeys
,nmeta rect=type=\keys
,nmeta c=align=c
,nmeta l=align=l
,nmeta r=align=r
}
\renewcommand*\NC@rewrite@k[1][]
{%
\keys@col@parse{#1}%
\NC@find
}
\newcommand\keys@col[1]{\if\relax\detokenize{#1}\relax\else\keys@col@{#1}\fi}
\makeatother
\usepackage{booktabs}
\begin{document}
\keys{\shift}\keys{ON}
\okeys{\shift;1}
\bigskip
\begingroup
\tabcolsep=1pt
\extrarowheight=1pt
\begin{tabular}{*4k}
\toprule
\multicolumn{4}{k[oval]}{ON} \\
\midrule
& \shift & ON \\
\midrule
0 & 1 & 2 & 3 \\
4 & 5 & 6 & 7 \\
& 8 & 9 \\
\bottomrule
\end{tabular}
\endgroup
\end{document}
```

[^1]: Disclaimer: I somehow ended up being one of the maintainers.
[^2]: `menukeys` uses Ti*k*Z internally, and since `tikzpicture`s aren't nestable (it doesn't throw an error, and sometimes works, but isn't really supported) you shouldn't do the placement with Ti*k*Z. What you could do is box the keys you need up using TeX-boxes and place those boxes with Ti*k*Z.