0

My tags are follows:

\documentclass{book}

\usepackage{tikz}
\usetikzlibrary{shapes,arrows}

\newcommand{\buttonfont}[1]{\textsf{\textbf{#1}}}

\newcommand*{\btn}[1]{\begin{tikzpicture}
    \node (1) [draw, rounded corners] {\buttonfont#1};
  \end{tikzpicture}}

\begin{document}

\btn{--}

\vspace{2pc}

\btn{x\textsuperscript{2}}

\end{document}

Output comes no issues, but is it possible to fix the height of the box should be consistent in all occurrences?

Please advise.

  • It should also be noted that \btn{--} and \btn{x\textsuperscript{2}} look different than \buttonfont{--} and \buttonfont{x\textsuperscript{2}} in terms of the space between the characters and the font used for 2. – John Kormylo Oct 20 '18 at 15:32
1

You can use the node option minimum height. For example,

enter image description here

\documentclass{book}

\usepackage{tikz}
\usetikzlibrary{shapes,arrows}

\newcommand{\buttonfont}[1]{\textsf{\textbf{#1}}}

\newcommand*{\btn}[1]{\begin{tikzpicture}
    \node (1) [draw, rounded corners,minimum height=2em] {\buttonfont{#1}};
  \end{tikzpicture}}

\begin{document}

\btn{--} \btn{x\textsuperscript{2}}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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