1

Related of this my previous question here: Search for a package to generate graphic displays of calculators I'm searching to write something as \sin^{-1} for my students similar to this picture taken from pag. 6, of the documentation of the package tipfr.

enter image description here

As all the users in TeX.SE. know, I don't know well the English language , let alone the French language, which I have never studied.

enter image description here

I have done this code:

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{tipfr}

\begin{document} With the calculator push on $\boxed{\text{2ndf}}(\ldots)$, $\boxed{\sin^{-1}}(\ldots)$. \begin{center} \Touche[style=second] \Touche[principal={\Sin},second={$\sin^{-1}$},alpha={H},name=PI] \end{center} \end{document}

but I have any problem attached into the image:

enter image description here

(sanserif or other font family), with an error:

Undefined control sequence. [...n},second={$\sin^{-1}$},alpha={H},name=PI]]

How to solve the problem?

Sebastiano
  • 54,118
  • 2
    Probably you wanted to use principal={$\sin$} instead of principal={\Sin}? This should help you get rid of the error message and also solve the problem you marked with the brown arrow in your screenshot. – leandriis Oct 11 '20 at 12:14
  • @leandriis Hi, I was looking your profile..and puff....you are here. I thinked that the principal was \Sin. Perfect....it is delete the brown error. Thank you very much much. – Sebastiano Oct 11 '20 at 12:16
  • The text "2nde" is hard-coded, so you might have to redefine the \touche command accordingly. Which of the following buttons would you prefer? 1: https://i.stack.imgur.com/x1hvw.png, 2: https://i.stack.imgur.com/jWf53.png or 3: https://i.stack.imgur.com/7kRUa.png – leandriis Oct 11 '20 at 12:36
  • 1
    Having had a closer look at the definition of the \Calculatrice command, I think you could use the following to get an output closest to the images shown in the documentation: \Touche[principal={sin},second={sin\textsuperscript{\textminus 1}},alpha={H},name=PI] https://i.stack.imgur.com/jYbqH.png – leandriis Oct 11 '20 at 12:38
  • Very kiind @leandriis thank you sincerely for your cooperation and many compliments for your 38k. For "2nde" I prefer the option first image: i.stack.imgur.com/x1hvw.png and perfect the setting of your picture of the last comment. – Sebastiano Oct 11 '20 at 15:03

1 Answers1

1

enter image description here

In the following example, I used

\Touche[principal={sin},second={sin\textsuperscript{\textminus 1}},alpha={H},name=PI]

in order to get the right button. This is inspired by the definition of the buttons you can find on page 12 of the documentation.

In order to change the text on the blue button from 2nde to 2dnf, I copied the definition of \Touche from tipfr.sty into the preamble of the MWE and replaced the hard coded text. I have highlighted the line I changed using <---- in the following example:

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{tipfr}

\makeatletter \renewcommand*\Touche[1][]{% \setkeys{Touche}{#1} %%----------------------------- % Touche blanche pour les chiffres %%----------------------------- \raisebox{\Hauteur@Touche}{ \ifthenelse{\boolean{ToucheChiffre}}% {\unskip\begin{tikzpicture}[x=0.5cm,y=0.5cm,remember picture] \draw[fill=white] (0,1)..controls+(40:0.4)and+(140:0.4).. (2,1) node[midway] (c) {} -- (2,1) arc (0:-180:1) -- cycle; \path (1,0) -- (c) node[pos=\La@Position] {\bfseries \Le@Principal}; \coordinate (\Le@Nom) at (c); \ifKV@Touche@circle\draw[\La@Couleur,line width=\Ep@isseur] (c) circle (\Le@Rayon);\fi \ifthenelse{\boolean{ModeSeconde}} {\ifthenelse{\boolean{ModeAlpha}} {\node[above] at (c) {\makebox[1.2cm][s]{\bfseries\sffamily\textcolor{blue}% {\Mode@Seconde}\hfill\textcolor{ForestGreen}{\Mode@Alpha}}};} {\node[above] at (c) {\bfseries\sffamily\textcolor{blue}{\Mode@Seconde}};}} {} \end{tikzpicture}}% {\unskip}% }% %%----------------------------- % Touche grise pour les opérations %%----------------------------- \raisebox{\Hauteur@Touche}{ \ifthenelse{\boolean{ToucheOperation}}% {\unskip\begin{tikzpicture}[x=0.5cm,y=0.5cm,remember picture] \draw[fill=gray] (0,1)..controls+(20:0.4)and+(160:0.4).. (2,1) node[midway] (c) {} -- (2,1)..controls+(-90:0.75)and+(0:0.5)..(1,0.2)..controls+(180:0.5)and+(-90:0.75)..(0,1) -- cycle ; \path (1,0.2) -- (c) node[color=white,pos=\La@Position] {\bfseries\sffamily \Le@Principal}; \coordinate (\Le@Nom) at (c); \ifKV@Touche@circle\draw[\La@Couleur,line width=\Ep@isseur] (c) circle (\Le@Rayon);\fi \ifthenelse{\boolean{ModeSeconde}} {\ifthenelse{\boolean{ModeAlpha}} {\node[above] at (c) {\makebox[1.2cm][s]{\bfseries\sffamily\textcolor{blue}% {\Mode@Seconde}\hfill\textcolor{ForestGreen}{\Mode@Alpha}}};} {\node[above] at (c) {\bfseries\sffamily\textcolor{blue}{\Mode@Seconde}};}} {} \end{tikzpicture}} {\unskip}% }% %%----------------------------- % Touche noire pour les fonctions %%----------------------------- \raisebox{\Hauteur@Touche}{ \ifthenelse{\boolean{ToucheFonction}} {\unskip\begin{tikzpicture}[x=0.5cm,y=0.5cm,remember picture] \draw[fill=black] (0,1)..controls+(20:0.4)and+(160:0.4).. (2,1) node[midway] (c) {} -- (2,1)..controls+(-90:0.75)and+(0:0.5)..(1,0.2)..controls+(180:0.5)and+(-90:0.75)..(0,1) -- cycle ; \path (1,0.2) -- (c) node[color=white,pos=\La@Position] {\bfseries\sffamily \Le@Principal}; \coordinate (\Le@Nom) at (c); \ifKV@Touche@circle\draw[\La@Couleur,line width=\Ep@isseur] (c) circle (\Le@Rayon);\fi \ifthenelse{\boolean{ModeSeconde}} {\ifthenelse{\boolean{ModeAlpha}} {\node[above] at (c) {\makebox[1.2cm][s]{\bfseries\sffamily\textcolor{blue}% {\Mode@Seconde}\hfill\textcolor{ForestGreen}{\Mode@Alpha}}};} {\node[above] at (c) {\bfseries\sffamily\textcolor{blue}{\Mode@Seconde}};}} {} \end{tikzpicture}} {\unskip}% }% %%----------------------------- % Touche grise pour les graphes %%----------------------------- \raisebox{\Hauteur@Touche}{ \ifthenelse{\boolean{ToucheGraphe}} {\unskip\begin{tikzpicture}[x=0.5cm,y=0.7cm,remember picture] \draw[fill=gray] (0,1)..controls+(20:0.4)and+(160:0.4).. (2,1) node[midway] (c) {} -- (2,1)..controls+(-90:0.3)and+(0:0.75)..(1,0.7)..controls+(180:0.75)and+(-90:0.3)..(0,1) -- cycle ; \path (1,0.2) -- (c) node[color=white,pos=\La@Position] {\bfseries\sffamily \Le@Principal}; \coordinate (\Le@Nom) at (c); \ifKV@Touche@circle\draw[\La@Couleur,line width=\Ep@isseur] (c) circle (\Le@Rayon);\fi \ifthenelse{\boolean{ModeSeconde}} {\ifthenelse{\boolean{ModeAlpha}} {\node[above] at (c) {\makebox[1.2cm][s]{\bfseries\sffamily\textcolor{blue}% {\Mode@Seconde}\hfill\textcolor{ForestGreen}{\Mode@Alpha}}};} {\node[above] at (c) {\bfseries\sffamily\textcolor{blue}{\Mode@Seconde}};}} {} \end{tikzpicture}} {\unskip}% }% %%----------------------------- % Touche Entrer %%----------------------------- \raisebox{\Hauteur@Touche}{ \ifthenelse{\boolean{ToucheEntrer}} {\unskip\begin{tikzpicture}[x=0.5cm,y=0.5cm,remember picture] \draw[fill=gray] (0,1)..controls+(20:0.4)and+(160:0.4).. (2,1) node[midway] (c) {} -- (2,1)..controls+(-90:0.75)and+(0:0.7)..(1,-0.5)..controls+(180:0.7)and+(-90:0.75)..(0,1) -- cycle ; \path (1,0.2) -- (c) node[color=white,pos=\La@Position] {\bfseries\sffamily \Le@Principal}; \coordinate (\Le@Nom) at (1,0.75); \ifKV@Touche@circle\draw[\La@Couleur,line width=\Ep@isseur] (1,0.75) circle (\Le@Rayon);\fi \ifthenelse{\boolean{ModeSeconde}} {\ifthenelse{\boolean{ModeAlpha}} {\node[above] at (c) {\makebox[1.2cm][s]{\bfseries\sffamily\textcolor{blue}% {\Mode@Seconde}\hfill\textcolor{ForestGreen}{\Mode@Alpha}}};} {\node[above] at (c) {\bfseries\sffamily\textcolor{blue}{\Mode@Seconde}};}} {} \end{tikzpicture}} {\unskip}% }% %%----------------------------- % Touche On/Off %%----------------------------- \raisebox{\Hauteur@Touche}{ \ifthenelse{\boolean{ToucheOnOff}} {\unskip\begin{tikzpicture}[x=0.5cm,y=0.5cm,remember picture] \draw[fill=black] (0,1)..controls+(20:0.4)and+(160:0.4).. (2,1) node[midway] (c) {} -- (2,1)..controls+(-90:0.75)and+(0:0.7)..(1,0)..controls+(180:0.7)and+(-90:0.75)..(0,1) -- cycle ; \path (1,0.2) -- (c) node[color=white,pos=\La@Position] {\fontsize{\Font@Size}{\Font@Size}\selectfont\bfseries\sffamily on}; \coordinate (\Le@Nom) at (c); \ifKV@Touche@circle\draw[\La@Couleur,line width=\Ep@isseur] (c) circle (\Le@Rayon);\fi \node[above] at (c) {\fontsize{\Font@Size}{\Font@Size}\selectfont\bfseries\sffamily\textcolor{blue}{off}}; \end{tikzpicture}} {\unskip}% }% %%----------------------------- % Touche 2nde %%----------------------------- \raisebox{\Hauteur@Touche}{ \ifthenelse{\boolean{ToucheSeconde}} {\unskip\begin{tikzpicture}[x=0.5cm,y=0.5cm,remember picture] \draw[fill=blue] (0,1)..controls+(20:0.4)and+(160:0.4).. (2,1) node[midway] (c) {} -- (2,1)..controls+(-90:0.75)and+(0:0.5)..(1,0.2)..controls+(180:0.5)and+(-90:0.75)..(0,1) -- cycle ; \coordinate (\Le@Nom) at (c); \ifKV@Touche@circle\draw[\La@Couleur,line width=\Ep@isseur] (c) circle (\Le@Rayon);\fi \path (1,0.2) -- (c) node[color=white,pos=\La@Position] {\fontsize{\Font@Size}{\Font@Size}\selectfont\bfseries\sffamily 2ndf}; % <------------------------ \end{tikzpicture}}% {\unskip}% }% %%----------------------------- % Touche Alpha %%----------------------------- \raisebox{\Hauteur@Touche}{ \ifthenelse{\boolean{ToucheAlpha}}% {\unskip\begin{tikzpicture}[x=0.5cm,y=0.5cm,remember picture] \draw[fill=ForestGreen] (0,1)..controls+(20:0.4)and+(160:0.4).. (2,1) node[midway] (c) {} -- (2,1)..controls+(-90:0.75)and+(0:0.5)..(1,0.2)..controls+(180:0.5)and+(-90:0.75)..(0,1) -- cycle ; \path (1,0.2) -- (c) node[color=white,pos=\La@Position] {\fontsize{\Font@Size}{\Font@Size}\selectfont\bfseries\sffamily alpha}; \coordinate (\Le@Nom) at (c); \ifKV@Touche@circle\draw[\La@Couleur,line width=\Ep@isseur] (c) circle (\Le@Rayon);\fi \node[above] at (c) {\fontsize{\Font@Size}{\Font@Size}\selectfont\bfseries\sffamily\textcolor{blue}{verr A}}; \end{tikzpicture}} {\unskip}% }% %%----------------------------- % Touche des flèches %%----------------------------- \raisebox{\Hauteur@Touche}{ \ifthenelse{\boolean{ToucheFleches}}% {\unskip\begin{tikzpicture}[\ifKV@Touche@fixed\else overlay\fi,xshift=\X@Decalage,yshift=\Y@Decalage,scale=\Scale@Fleches] \fill[white] ({cos(110) -0.1},{sin(110)-0.2}) -- ({cos(160)+0.4},{sin(160)+0.12}) arc(30:-30:1) -- ({cos(-110) -0.1},{sin(-110)+0.2}) arc(-30:30:1.47) ; \fill[white,xscale=-1] ({cos(110) -0.1},{sin(110)-0.2}) -- ({cos(160)+0.4},{sin(160)+0.12}) arc(30:-30:1) -- ({cos(-110) -0.1},{sin(-110)+0.2}) arc(-30:30:1.47) ; \draw[fill=gray] ({cos(70)},{sin(70)}) arc (70:110:1) ..controls+(220:0.1)and+(90:0.1).. +(-0.1,-0.2) arc(30:-30:1.47) ..controls+(-90:0.1)and+(140:0.1).. ({cos(-110)},{sin(-110)}) arc (-110:-70:1)..controls+(40:0.1)and+(-90:0.1).. +(0.1,0.2) arc (210:150:1.47) ..controls+(90:0.1)and+(-40:0.1).. ({cos(70)},{sin(70)}); \draw[fill=gray] ({cos(160)},{sin(160)}) arc(160:200:1) ..controls+(-45:0.2)and+(170:0.2).. +(0.4,-0.2) arc(-30:30:1) ..controls+(180:0.2)and+(30:0.2).. ({cos(160)},{sin(160)}); \draw[fill=gray,xscale=-1] ({cos(160)},{sin(160)}) arc(160:200:1) ..controls+(-45:0.2)and+(170:0.2).. +(0.4,-0.2) arc(-30:30:1) ..controls+(180:0.2)and+(30:0.2).. ({cos(160)},{sin(160)}); \fill[white] (0,0.9) -- +(-0.15,-0.15) -- +(0.15,-0.15)-- cycle; \fill[white] (-0.9,0) -- +(0.15,0.15) -- +(0.15,-0.15)-- cycle; \fill[white,yscale=-1] (0,0.9) -- +(-0.15,-0.15) -- +(0.15,-0.15)-- cycle; \fill[white,xscale=-1] (-0.9,0) -- +(0.15,0.15) -- +(0.15,-0.15)-- cycle; \coordinate (FLE) at (0,0); \coordinate (FLH) at (0,0.825); \coordinate (FLB) at (0,-0.825); \coordinate (FLD) at (0.825,0); \coordinate (FLG) at (-0.825,0); \ifKV@Touche@arrowdown\draw[\La@Couleur,line width=\Ep@isseur] (FLB) circle (10pt);\fi \ifKV@Touche@arrowleft\draw[\La@Couleur,line width=\Ep@isseur] (FLG) circle (10pt);\fi \ifKV@Touche@arrowtot\draw[\La@Couleur,line width=\Ep@isseur] (FLE) circle (30pt);\fi \ifKV@Touche@arrowup\draw[\La@Couleur,line width=\Ep@isseur] (FLH) circle (10pt);\fi \ifKV@Touche@arrowright\draw[\La@Couleur,line width=\Ep@isseur] (FLD) circle (10pt);\fi \end{tikzpicture}} {\unskip}% }% } \makeatother

\begin{document} With the calculator push on $\boxed{\text{2ndf}}(\ldots)$, $\boxed{\sin^{-1}}(\ldots)$. \begin{center} \Touche[style=second] \Touche[principal={sin},second={sin\textsuperscript{\textminus 1}},alpha={H},name=PI] \end{center} \end{document}

leandriis
  • 62,593
  • Thank you very much. But you have done a lot of work, to change the France language in English language? +1 and check mark. Excellent. – Sebastiano Oct 11 '20 at 15:24
  • 1
    @Sebastiano: You're welcome. Actually, changing the text on the blue button was not that difficult, although it requires a quite lengthy piece of code to do so. (Probably there is a more elegant way to do so, that I currently do not know of?) The only thing I really did was opening tipfr.sty, searching for "2nde", copying the whole definition of the corresponding command into the preamble of the document and replacing "2nd2" with "2ndf" in the highlighted line. – leandriis Oct 11 '20 at 16:12
  • It is always a lot of work also to search the .sty file. All the best...also for you. – Sebastiano Oct 11 '20 at 19:36