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've got the following code below to mimic a TI83 Calculator screen, but I'm stuck on adding a couple of things I'd like to add.

  1. I'd like to make the \overline{x} in text mode. I tried \={x}, and although that works in LaTeX, it doesn't work on our system. Any other ideas on how I can produce an overline over x in text mode?

  2. I'd also like to try to take this:

     \def\input{\calcinput{\ Inpt:Data\ Stats}}
    

    and put the word Stats in the color white with a solid black background behind it.

Any thoughts?

\documentclass[11pt]{scrartcl} 
\usepackage{tikz}
\usepackage{xparse}
\newcommand\tsurd{\ensuremath{\sqrt{\phantom{i}}}}
\newcommand\txbar{\ensuremath{\overline{x}}}
\ExplSyntaxOn
\NewDocumentCommand{\calcinput}{m}
{
 \tl_map_inline:nn { #1 } { ##1 \hspace{0pt} }
}
\ExplSyntaxOff

\begin{document}

\def\tinterval{\calcinput{TInterval}}
\def\input{\calcinput{\ Inpt:Data\ Stats}}
\def\xbar{\calcinput{\ \txbar:10}}
\def\s{\calcinput{\ Sx:2.345678}}
\def\n{\calcinput{\ n:12}}
\def\cl{\calcinput{\ C-Level:0.95}}
\def\calc{\calcinput{\ Calculate}}


\begin{center}
\begin{tikzpicture}[font=\large\ttfamily]
\draw (0,0) rectangle (5,-4);
\node[align=flush left,text width =5cm,
     anchor=north west,inner sep=1pt] (tinterval) {\tinterval};
\node[align=flush left,text width =5cm,
     anchor=north west,inner sep=1pt] (input) at (tinterval.south west) {\input};
\node[align=flush left,text width =5cm,
     anchor=north west,inner sep=1pt] (xbar) at (input.south west) {\xbar};
\node[align=flush left,text width =5cm,
     anchor=north west,inner sep=1pt] (s) at (xbar.south west) {\s};
\node[align=flush left,text width =5cm,
     anchor=north west,inner sep=1pt] (n) at (s.south west) {\n};
\node[align=flush left,text width =5cm,
     anchor=north west,inner sep=1pt] (cl) at (n.south west) {\cl};
\node[align=flush left,text width =5cm,
     anchor=north west,inner sep=1pt] (calc) at (cl.south west) {\calc};
\end{tikzpicture}
\end{center}
\end{document} 
share|improve this question
    
Regarding point 1: \newcommand\txbar{\texttt{\=x}}? What “doesn't work” an your system? Error message? Erroneous output? –  Qrrbrbirlbel Nov 12 '12 at 5:39
    
We wrote a system at our college which creates randomly generated exercises online for our students. Teachers use them as homework, quizzes, preparation for exams, class activities, etc. The base file has a coding section for perl code, where we can generate random variables that are used in the main file. The code sheet is processed by perl and system scripts, then the result is compiled in Latex. Consequently, sometimes certain symbols are used in dual roles so sometimes something won't work, but not that often. –  David Nov 12 '12 at 9:24

1 Answer 1

You can use \text{x} from the amsmath package to typeset the x in text mode, and \colorbox{black}{\textcolor{white}{Stats}} to obtain the white text, with a black background:

enter image description here

Notes:

  • I would recommend you not use \input as a macro name. That is a predefined LaTeX macro. So to minimize those kinds of errors I would recommend you use LaTeX's \newcommand rather than TeX's \def. I have updated the MWE below to reflect this.
  • Also, if you use \tikzset to define a style as:

    \tikzset{My Node Style/.style={
       align=flush left,text width =5cm, anchor=north west,inner sep=1pt}
    }
    

    you can greatly simplify your code as I have done below.

Code:

\documentclass[11pt]{scrartcl} 
\usepackage{tikz}
\usepackage{xparse}
\usepackage{xcolor}
\usepackage{amsmath}

\newcommand\tsurd{\ensuremath{\sqrt{\phantom{i}}}}
\newcommand\txbar{\ensuremath{\overline{\text{x}}}}
\ExplSyntaxOn
\NewDocumentCommand{\calcinput}{m}
{
 \tl_map_inline:nn { #1 } { ##1 \hspace{0pt} }
}
\ExplSyntaxOff

\begin{document}

\newcommand*{\tinterval}{\calcinput{TInterval}}
\newcommand*{\Inpt}{\calcinput{\ Inpt:Data\ {\colorbox{black}{\textcolor{white}{Stats}}}}}

\newcommand*{\InptData}{\calcinput{\ Inpt:Data\ }}
\newcommand*{\Stat}{\calcinput{Stats}}

\newcommand*{\xbar}{\calcinput{\ \txbar:10}}
\newcommand*{\s}{\calcinput{\ Sx:2.345678}}
\newcommand*{\n}{\calcinput{\ n:12}}
\newcommand*{\cl}{\calcinput{\ C-Level:0.95}}
\newcommand*{\calc}{\calcinput{\ Calculate}}

\tikzset{My Node Style/.style={
    align=flush left,text width =5cm,
    anchor=north west,inner sep=1pt}
}

\begin{center}
\begin{tikzpicture}[font=\large\ttfamily]
    \fboxsep=0.5pt
    \coordinate (Origin) at (0,0);
    \draw (Origin) rectangle (5,-4);
    \node[My Node Style] (tinterval) at (Origin)               {\tinterval};
    \node[My Node Style] (Inpt)      at (tinterval.south west) {\Inpt};
    \node[My Node Style] (xbar)      at (Inpt.south west)      {\xbar};
    \node[My Node Style] (s)         at (xbar.south west)      {\s};
    \node[My Node Style] (n)         at (s.south west)         {\n};
    \node[My Node Style] (cl)        at (n.south west)         {\cl};
    \node[My Node Style] (calc)      at (cl.south west)        {\calc};
\end{tikzpicture}
\end{center}
\end{document} 
share|improve this answer
    
Thanks. This worked very nicely. –  David Nov 12 '12 at 9:20

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.