tipfr 包:如何编写一些按钮(要求:仅 pdfLaTeX)

tipfr 包:如何编写一些按钮(要求:仅 pdfLaTeX)

与此相关的是我之前的问题:搜索用于生成计算器图形显示的包我正在寻找为我的学生写一些\sin^{-1}类似于这张从包文档第 6 页拍摄的图片的东西蒂普弗

在此处输入图片描述

正如 TeX.SE 的所有用户所知,我不太懂英语

答案1

在此处输入图片描述

在下面的例子中,我使用了

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

以便获取正确的按钮。这是受到文档第 12 页上按钮定义的启发。

为了将蓝色按钮上的文本从 更改2nde为,我将from2dnf的定义复制到 MWE 的序言中并替换了硬编码文本。我在以下示例中突出显示了我更改的行:\Touchetipfr.sty<----

\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}

相关内容