Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using a little TikZ Code to typeset Calculator keys, which works pretty well in general. I only have one problem: when I type just single lines I would like to have the corresponding box as big as the ones with two parts in it.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[]{amsmath}
\setlength{\parskip}{1em}

\usepackage{tikz}
\usetikzlibrary{positioning,shapes,shadows}

\tikzstyle{abstract}=[rectangle, draw=black, rounded corners, fill=gray!30,drop shadow, text centered,  text=black, text width=8mm]
\tikzstyle{fkey}=[rectangle, draw=black, rounded corners, fill=orange,drop shadow, text centered,  text=black, text width=8mm]
\tikzstyle{gkey}=[rectangle, draw=black, rounded corners, fill=blue!40,drop shadow, text centered,  text=black, text width=8mm]

\newcommand{\mykey}[2]{%
\begin{tikzpicture} \node (Item) [abstract, rectangle split, rectangle split parts=2]{\textbf{\scriptsize{#1}} \nodepart{second}\textbf{\tiny{#2}}};%
\end{tikzpicture}}

\newcommand{\myfkey}{%
\begin{tikzpicture} \node (Item) [fkey, rectangle split, rectangle split parts=2]{\textbf{\footnotesize{f}} \nodepart{second}};%
\end{tikzpicture}}

\newcommand{\mygkey}{%
\begin{tikzpicture} \node (Item) [gkey, rectangle split, rectangle split parts=2]{\textbf{\footnotesize{g}} \nodepart{second}};%
\end{tikzpicture}}

\newcommand{\mynumberkey}[1]{%
\begin{tikzpicture} \node (Item) [abstract]{\textbf{#1}};%
\end{tikzpicture}}


\begin{document}


 \mykey{n}{$12x$}

 \mykey{SST}{$\Delta \text{DYS}$}

 \myfkey

 \mygkey

 \mykey{Enter}{=}

\mynumberkey{3}

\end{document}

calculator keys

share|improve this question
1  
Not an answer to your question, but do you know that you can use ttf fonts for calculators? Like Texas or HP –  Ignasi May 18 '12 at 10:51
add comment

1 Answer 1

up vote 15 down vote accepted

You can simply add, when you define the styles, minimum height=....

For example:

\tikzset{abstract/.style={rectangle, 
       draw=black,
       rounded corners,
       fill=gray!30,
       drop shadow,
       text centered,
       text=black,
       text width=8mm,
       minimum height=0.75cm,
   }
}
\tikzstyle{fkey/.style={rectangle, 
       draw=black,
       rounded corners,
       fill=orange,
       drop shadow,
       text centered,
       text=black, 
       text width=8mm,
       minimum height=0.75cm,
  }
}
\tikzstyle{gkey/.style={rectangle, 
      draw=black,
      rounded corners,
      fill=blue!40,
      drop shadow,
      text centered,
      text=black, 
      text width=8mm,
      minimum height=0.75cm,
   }
}

in your preamble will lead to:

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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