% \iffalse meta-comment % % Package lcd % Copyright (c) 2004 Mike Kaufmann, all rights reserved % % This program is provided under the terms of the % LaTeX Project Public License distributed from CTAN % archives in directory macros/latex/base/lppl.txt. % % Author: Mike Kaufmann % Mike.Kaufmann@ei.fh-giessen.de % \fi %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z %% Digits \0\1\2\3\4\5\6\7\8\9 %% Exclamation \! Double quote \" Hash (number) \# %% Dollar \$ Percent \% Ampersand \& %% Acute accent \' Left paren \( Right paren \) %% Asterisk \* Plus \+ Comma \, %% Minus \- Point \. Solidus \/ %% Colon \: Semicolon \; Less than \< %% Equals \= Greater than \> Question mark \? %% Commercial at \@ Left bracket \[ Backslash \\ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} %% % \CheckSum{469} % % \iffalse meta-comment % %<*package> \def\fileversion{0.3} \def\filedate{2004/01/05} % % %<*driver> \documentclass{ltxdoc} \usepackage[latin1]{inputenc} % redefine µ (\mu) to get it right in source code listing \DeclareInputText{181}{\ensuremath{\mu}} \usepackage{lcd} \EnableCrossrefs \CodelineIndex \RecordChanges %\OnlyDescription \begin{document} \DocInput{lcd.dtx} \end{document} % % %<*package> % \fi % % ^^A Don't ask me why, but the first two \DoNotIndex-line don't work % \DoNotIndex{\",\#,\$,\%,\&,\^,\_,\~} % \DoNotIndex{\^^b0,\^^b5,\^^b7,\^^df,\^^e4,\^^f6,\^^fc} % \DoNotIndex{\@@end,\@empty,\@ifundefined} % \DoNotIndex{\@tempa,\@tempcnta,\@tempcntb} % \DoNotIndex{\AtBeginDocument,\advance,\addtocounter} % \DoNotIndex{\begin,\begingroup} % \DoNotIndex{\csname,\catcode,\color,\colorbox} % \DoNotIndex{\def} % \DoNotIndex{\else,\end,\endgroup,\endcsname,\expandafter} % \DoNotIndex{\fboxsep,\framebox} % \DoNotIndex{\global} % \DoNotIndex{\fi,\filedate,\fileversion} % \DoNotIndex{\hspace} % \DoNotIndex{\if,\ifnum,\ifx} % \DoNotIndex{\let,\line,\linethickness} % \DoNotIndex{\makebox,\multiply} % \DoNotIndex{\NeedsTeXFormat,\newcommand,\newcounter,\newlength,\newif} % \DoNotIndex{\obeyspaces} % \DoNotIndex{\ProvidesPackage,\put} % \DoNotIndex{\relax} % \DoNotIndex{\space,\setlength,\setcounter,\settoheight,\stepcounter} % \DoNotIndex{\the} % \DoNotIndex{\unitlength} % \DoNotIndex{\z@} % % ^^A\changes{0.3}{2004/01/04}{initial release} % % ^^A\MakeShortVerb{\+} % ^^A\DeleteShortVerb{\|} % % \newcommand*{\bs}{\char '134 } % \newcommand*{\lb}{\char '173 } % \newcommand*{\rb}{\char '175 } % \newcommand*{\param}[1]{\texttt{\textit{#1}}} % \newcommand*\lcd{\textLCD{3}|LCD|} % % \title{The \lcd\ Package\\alphanumerical LCDisplays with \LaTeX} % \author{Mike Kaufmann\\|Mike.Kaufmann@ei.fh-giessen.de|} % \date{\filedate~(v\fileversion)} % ^^A-------------------------------------------------------------------------- % \maketitle % \begin{abstract} % The \lcd\ Package provides macros that display text which looks like on % alphanumerical LCDisplays. % \end{abstract} % % \tableofcontents % % ^^A-------------------------------------------------------------------------- % \newpage % \section{Introduction} % \subsection{Why this Package}\label{sec:why} % Without this package you can show the contents of an alphanumerical LCDisplay % with the typewriter font or you can take a picture and include it in your % document. The typewriter font doesn't provide all characters possible on an % LCD and perhaps a picture will need postprocessing. % % \begin{center} % \LCD{4}{40}+With the LCD package text appears like + % +on an alphanumerical LCDisplay (colors + % +are available) and you can easily define+ % +your own symbols (5x7 dot matrix). + % \end{center} % % ^^A--------------------------------------------- % \subsection{Making the Stylefile} % Because character with ASCII-codes greater then 127 are used in the % macro code, your TeX must be able to handle 8-bit ASCII to get a correct % stylefile! % % After generating the file lcd.sty search for the string ``|^^|'' (followed % by a hex-number). If you find it, you are in trouble. % % If you are using teTeX the command % \begin{verbatim} % tex --translate-file=cp8bit lcd.ins\end{verbatim} % ^^A\end{verbatim} % will work properly. % % Here a list of the hex-number--character pairs:\newline % |^^b5| $\to \mu$, |^^b0| $\to \;^\circ$, |^^b7| $\to \cdot$, % |^^e4| $\to$ \"a, |^^f6| $\to$ \"o, |^^fc| $\to$ \"u, % |^^df| $\to$ \ss.\newline % The list applies to Linux. There might be more trouble with other operating % systems. But in worst case only these characters will not work. % % ^^A--------------------------------------------- % \subsection{Legal Stuff} % This program is provided under the terms of the % LaTeX Project Public License distributed from CTAN % archives in directory macros/latex/base/lppl.txt. % % ^^A-------------------------------------------------------------------------- % \section{Using the Package} % \subsection{The main \protect\lcd\ Macros}\label{sec:mac} % \DescribeMacro\LCD % To show the contents of an alphanumerical LCDisplay the macro % \begin{center} % |\LCD{|\param{LCDlines}|}{|\param{LCDcolumns}|}|\meta{delimchar}\param{LCDtext}\meta{delimchar}\\ % \ldots \meta{delimchar}\param{LCDtext}\meta{delimchar} % \end{center} % can be used. % % Here \param{LCDlines} is the number of lines you want to have. It has to be % at least one, which is tested and corrected if necessary, but without any % message or warning. % % The parameter \param{LCDcolumns} is the number of columns you want to have. It also % has to be at least one, but there is no test, message or warning jet. % % The numbers of lines and columns are not limited by the macro. But of course % there are limits by \TeX. % % The delimiter character \meta{delimchar} has to follow immediately after the % \param{LCDcolumns} parameter. It can be any character with catcode 11 or 12, % which means that active characters, a space and characters with a special % meaning to \TeX\ are not allowed. Of course \meta{delimchar} must not be part % of \param{LCDtext}. % % The opening \meta{delimchar} of one LCD-line can follow % immediately after the closing \meta{delimchar} of the line before. And there % can be spaces and/or newlines between these delimiters. Also text can be % there, but since it will be ignored it wouldn't make any sense. % % The \param{LCDtext} can consist of nearly any characters you can type, expect % of |\|, |{| and |}|. The braces are used to enclose so called multi-letter % characters, which are used to show symbols you can't type (e.g.\ |{clock}| to % get a clock symbol; see \ref{sec:pre} for more). % % The example in \ref{sec:why} was produced with % \begin{verbatim} % \LCD{4}{40}+With the LCD package text appears like + % +on an alphanumerical LCDisplay (colors + % +are available) and you can easily define+ % +your own symbols (5x7 dot matrix). +\end{verbatim} % ^^A\end{verbatim} % % \DescribeMacro\textLCD % To put \param{LCDtext} in normal text the macro % \begin{center} % |\textLCD[|\param{LCDcorr}|]{|\param{LCDcolumns}|}|\meta{delimchar}\param{LCDtext}\meta{delimchar} % \end{center} % can be used. % % For \param{LCDcolumns}, \meta{delimchar} and \param{LCDtext} applies the same as % for these parameters in |\LCD|. % % The parameter \param{LCDcorr} is optional. It is used to reduce or enlarge % the space between the \param{LCDtext} and the surrounding normal text. The % default value ($-2$) fits for white backgrounded \param{LCDtext}. If you have % a background color the correct value is 0. It has to be a decimal number. % % \DescribeMacro\textLCDcorr % The default value is defined as the macro % |\textLCDcorr|. If you want to change the default value globaly, you can % redefine this macro in the preamble by typing % |\renewcommand{\textLCDcorr}{|\param{newdefault}|}| where \param{newdefault} % must be only a decimal number. % % ^^A--------------------------------------------- % \subsection{Restrictions} % There are some restrictions you have to remember when using the \lcd\ package. % Ignoring them will lead to strange behavior or strange error messages. % And there are no package errors or package warnings jet. Here are the % restrictions: % % \begin{itemize} % \item There have to be exactly the number of LCD-lines given in the % \param{LCDlines}-Parameter. Lines that are too much will be printed as % normal text including the delimiter characters. If there are not enough % lines, you'll get a ``Runaway argument'' error or other strange things. % \item After a multi-letter character there have to be at least one other % charater, otherwise you'll get the word instead of the symbol % (e.g.\ the word ``clock'' and not the clock symbol). If a multi-letter % character is the last one in the line, just type a space after it. % \item The number of characters in a line is not tested. If there are too many % characters, they will be drawn over the right end. % \item It is not possible to place comments between the LCD-lines, the \%-sign % will be ignored there and in \param{LCDtext} it is a normal character. % \item There can't be a linebreak in \param{LCDtext} when using |\textLDC|. % \item You can't use the |\LCD| and |\textLCD| macro in other macros or as % parameter to a macro. Well, if the LCD-text only consists of letters, % digits and some other characters it would work. But a space, active % characters and characters with a special meaning to \TeX\ (all % characters with other catcodes than 11 or 12) wouldn't work. If you want % to use |\textLCD| in sectioning commands or in captions, you have to % |\protect| it. % \item You can't use the |\LCD| and |\textLCD| macro in boxes like |\parbox|, % |\raisebox| or |\makebox| (with the same exceptions as to the point % above). But you can use it in environments like |minipage| or |figure|. % \end{itemize} % % ^^A--------------------------------------------- % \subsection{Size}\label{sec:size} % \DescribeMacro\LCDunitlength % To specify the absolte size of the LCD representation you have to set the length % |\LCDunitlength|. It represents the width of a dot plus the gap between the % dots. The default value is 0.5\,mm. % % For |\textLCD| the size is calculated automaticly so that the height of % \param{LCDtext} and the surrounding text fits. This does not affect % |\LCDunitlength|. % % ^^A--------------------------------------------- % \subsection{Frames}\label{sec:frame} % \DescribeMacro\LCDnoframe % \DescribeMacro\LCDframe % By default a frame is drawn around the LCD representation. You can change this % behavior with the macro % |\LCDnoframe| in the preamble or befor the |\LCD| command. With % |\LCDframe| you can switch back to the default. Note that with |\textLCD| % there will never be a frame for typographical reasons. % % ^^A--------------------------------------------- % \subsection{Using Colors}\label{sec:color} % \DescribeMacro\LCDcolors % To use colors you need the color package and you have to define foreground, % background and frame colors. The latter because the \lcd\ package only handles % named colors. After that you can set the colors with % \begin{center} % |\LCDcolors[|\param{framecolor}|]{|\param{foregroundcolor}|}{|\param{backgroundcolor}|}|. % \end{center} % This can be done in the preamble or befor the |\LCD| or |\textLCD| command. % The parameter \param{framecolor} is optional and the frame color will be set % to black if it is not given. The default colors where set with % |\LCDcolors{black}{white}|. % % ^^A--------------------------------------------- % \subsection{Predefined Characters}\label{sec:pre} % Of course all letters (A--Z and a--z), digits (0--9) and the characters % ! ' ( ) * + , - . / : ; $<$ = $>$ ? [ ] ` and $\vert$ are predefined. % You can also type \$ \# $\mu$ $^\circ$ $\cdot$ \"a \"o \"u \ss\ " \% \& % \^\ and \_ dircetly. The character \~\ will be shown as a space. % % Some characters are available as multi-letter characters. % These are a clock symbol (|{clock}|), a right arrow (|{rarrow}|), a left arrow % (|{larrow}|), $\Omega$ (|{Omega}|), $\Sigma$ (|{Sigma}|), $\pi$ (|{pi}|), % a square root symbol (|{sqrt}|), a rectangle (|{rect}|), % a full cursor (|{fcur}|), \{ (|{lb}|), \} (|{rb}|) and $\alpha$ (|{alpha}|). % % ^^A--------------------------------------------- % \subsection{Defining new Characters}\label{sec:def} % \DescribeMacro\DefineLCDchar % New characters can be defined with % |\DefineLCDchar{|\param{char}|}{|\param{charmatrix}|}|. % % Here \param{char} can be a single character or multiple letters. Note % that characters with catcodes other than 11 or 12 (characters that are % control sequences or have a special meaning to \TeX) will cause troubble. % Use mutiple letters instead. % % LCD characters are shown as a $5\times7$ dot matrix. Other matrix dimensions % are not possible. So in \param{charmatrix} you have to type exactly 35 % times |0| or |1|, the ones are for visible dots. The first five ar for the % first dot row, the next five are for the second dot row and so on. % % As example, lets define an Euro symbol: % % \begin{figure}[htbp] % \centering % \unitlength2mm % \begin{picture}(54,10) % \put(0,8){\makebox(0,0)[bl]{ % \texttt{\bs DefineLCDchar\lb euro\rb\lb00111010001111101000111110100000111\rb}}} % \put(5.5,6.5){\line(1,0){16.7}}\put(22.2,6.5){\line(0,1){1}}\put(20.2,7.5){\line(1,0){4}} % \put(5.5,5.5){\line(1,0){21.4}}\put(26.9,5.5){\line(0,1){2}}\put(24.9,7.5){\line(1,0){4}} % \put(5.5,4.5){\line(1,0){26.1}}\put(31.6,4.5){\line(0,1){3}}\put(29.5,7.5){\line(1,0){4}} % \put(5.5,3.5){\line(1,0){30.8}}\put(36.3,3.5){\line(0,1){4}}\put(34.3,7.5){\line(1,0){4}} % \put(5.5,2.5){\line(1,0){35.5}}\put(41.0,2.5){\line(0,1){5}}\put(39.0,7.5){\line(1,0){4}} % \put(5.5,1.5){\line(1,0){40.2}}\put(45.7,1.5){\line(0,1){6}}\put(43.7,7.5){\line(1,0){4}} % \put(5.5,0.5){\line(1,0){44.9}}\put(50.4,0.5){\line(0,1){7}}\put(48.4,7.5){\line(1,0){4}} % \multiput(0,0)(1,0){6}{\line(0,1){7}} % \multiput(0,0)(0,1){8}{\line(1,0){5}} % \linethickness{0.7\unitlength} % \put(2,6.35){\line(1,0){0.7}} % \put(3,6.35){\line(1,0){0.7}} % \put(4,6.35){\line(1,0){0.7}} % \put(1,5.35){\line(1,0){0.7}} % \put(0,4.35){\line(1,0){0.7}} % \put(1,4.35){\line(1,0){0.7}} % \put(2,4.35){\line(1,0){0.7}} % \put(3,4.35){\line(1,0){0.7}} % \put(4,4.35){\line(1,0){0.7}} % \put(1,3.35){\line(1,0){0.7}} % \put(0,2.35){\line(1,0){0.7}} % \put(1,2.35){\line(1,0){0.7}} % \put(2,2.35){\line(1,0){0.7}} % \put(3,2.35){\line(1,0){0.7}} % \put(4,2.35){\line(1,0){0.7}} % \put(1,1.35){\line(1,0){0.7}} % \put(2,0.35){\line(1,0){0.7}} % \put(3,0.35){\line(1,0){0.7}} % \put(4,0.35){\line(1,0){0.7}} % \end{picture} % \caption{Defining a new Character} % \end{figure} % % ^^A--------------------------------------------- % \subsection{Package Options} % Only for completeness: there are no package options in this version. % % ^^A-------------------------------------------------------------------------- % \StopEventually{\newpage\PrintIndex \PrintChanges} % % ^^A-------------------------------------------------------------------------- % \newpage % \section{The Code} % \subsection{The Usual} % First the usual things. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[2001/06/01] \ProvidesPackage{lcd}[\filedate\space v\fileversion\space drawing alphanumerical LCDisplays] % \end{macrocode} % % ^^A--------------------------------------------- % \subsection{Defining Characters and predefined Characters} % \begin{macro}{\DefineLCDchar} % The macro |\DefineLCDchar| defines a macro |\@LCD@|\param{char} for every % character. % \begin{macrocode} \newcommand*\DefineLCDchar[2]{% \global\expandafter\def\csname @LCD@#1\endcsname{#2}} % \end{macrocode} % \end{macro} % % \noindent % Here are the predefined characters. % \begin{macrocode} \DefineLCDchar{A}{01110100011000110001111111000110001} \DefineLCDchar{B}{11110100011000111110100011000111110} \DefineLCDchar{C}{01110100011000010000100001000101110} \DefineLCDchar{D}{11100100101000110001100011001011100} \DefineLCDchar{E}{11111100001000011111100001000011111} \DefineLCDchar{F}{11111100001000011111100001000010000} \DefineLCDchar{G}{01110100011000010111100011000101110} \DefineLCDchar{H}{10001100011000111111100011000110001} \DefineLCDchar{I}{01110001000010000100001000010001110} \DefineLCDchar{J}{00111000100001000010000101001001100} \DefineLCDchar{K}{10001100101010011000101001001010001} \DefineLCDchar{L}{10000100001000010000100001000011111} \DefineLCDchar{M}{10001110111010110101100011000110001} \DefineLCDchar{N}{10001100011100110101100111000110001} \DefineLCDchar{O}{01110100011000110001100011000101110} \DefineLCDchar{P}{11110100011000111110100001000010000} \DefineLCDchar{Q}{01110100011000110001101011001001101} \DefineLCDchar{R}{11110100011000111110101001001010001} \DefineLCDchar{S}{01111100001000001110000010000111110} \DefineLCDchar{T}{11111001000010000100001000010000100} \DefineLCDchar{U}{10001100011000110001100011000101110} \DefineLCDchar{V}{10001100011000110001100010101000100} \DefineLCDchar{W}{10101101011010110101101011010101010} \DefineLCDchar{X}{10001100010101000100010101000110001} \DefineLCDchar{Y}{10001100011000101010001000010000100} \DefineLCDchar{Z}{11111000010001000100010001000011111} \DefineLCDchar{a}{00000000000111100001011111000101111} \DefineLCDchar{b}{10000100001011011001100011000111110} \DefineLCDchar{c}{00000000000111010000100001000101110} \DefineLCDchar{d}{00001000010110110011100011000101111} \DefineLCDchar{e}{00000000000111010001111111000001110} \DefineLCDchar{f}{00110010010100011100010000100001000} \DefineLCDchar{g}{00000011111000110001011110000101110} \DefineLCDchar{h}{10000100001011011001100011000110001} \DefineLCDchar{i}{00100000000110000100001000010001110} \DefineLCDchar{j}{00010000000011000010000101001001100} \DefineLCDchar{k}{10000100001001010100110001010010010} \DefineLCDchar{l}{01100001000010000100001000010001110} \DefineLCDchar{m}{00000000001101010101101011000110001} \DefineLCDchar{n}{00000000001011011001100011000110001} \DefineLCDchar{o}{00000000000111010001100011000101110} \DefineLCDchar{p}{00000000001111010001111101000010000} \DefineLCDchar{q}{00000000000110110011011110000100001} \DefineLCDchar{r}{00000000001011011001100001000010000} \DefineLCDchar{s}{00000000000111010000011100000111110} \DefineLCDchar{t}{01000010001110001000010000100100110} \DefineLCDchar{u}{00000000001000110001100011001101101} \DefineLCDchar{v}{00000000001000110001100010111000100} \DefineLCDchar{w}{00000000001010110101101011010101110} \DefineLCDchar{x}{00000000001000101010001000101010001} \DefineLCDchar{y}{00000000001000110001011110000101110} \DefineLCDchar{z}{00000000001111100010001000100011111} \DefineLCDchar{0}{01110100011001110101110011000101110} \DefineLCDchar{1}{00100011000010000100001000010001110} \DefineLCDchar{2}{01110100010000100010001000100011111} \DefineLCDchar{3}{11111000100010000010000011000101110} \DefineLCDchar{4}{00010001100101010010111110001000010} \DefineLCDchar{5}{11111100001111000001000011000101110} \DefineLCDchar{6}{00110010001000011110100011000101110} \DefineLCDchar{7}{11111000010001000100010000100001000} \DefineLCDchar{8}{01110100011000101110100011000101110} \DefineLCDchar{9}{01110100011000101111000010001001100} \DefineLCDchar{!}{00100001000010000100000000000000100} \DefineLCDchar{'}{01100001000100000000000000000000000} \DefineLCDchar{(}{00010001000100001000010000010000010} \DefineLCDchar{)}{01000001000001000010000100010001000} \DefineLCDchar{*}{00000001001010101110101010010000000} \DefineLCDchar{+}{00000001000010011111001000010000000} \DefineLCDchar{,}{00000000000000000000011000010001000} \DefineLCDchar{-}{00000000000000011111000000000000000} \DefineLCDchar{.}{00000000000000000000000000110001100} \DefineLCDchar{/}{00000000010001000100010001000000000} \DefineLCDchar{:}{00000011000110000000011000110000000} \DefineLCDchar{;}{00000011000110000000011000010001000} \DefineLCDchar{<}{00010001000100010000010000010000010} \DefineLCDchar{=}{00000000001111100000111110000000000} \DefineLCDchar{>}{10000010000010000010001000100010000} \DefineLCDchar{?}{01110100010000100010001000000000100} \DefineLCDchar{[}{01110010000100001000010000100001110} \DefineLCDchar{]}{01110000100001000010000100001001110} \DefineLCDchar{`}{01000001000001000000000000000000000} \DefineLCDchar{|}{00100001000010000100001000010000100} % \end{macrocode} % % \noindent % And the predefined multi-letter characters. % \begin{macrocode} \DefineLCDchar{clock}{01110100011000111101101011010101110} \DefineLCDchar{rarrow}{00000001000001011111000100010000000} \DefineLCDchar{larrow}{00000001000100011111010000010000000} \DefineLCDchar{Omega}{00000011101000110001010101101100000} \DefineLCDchar{Sigma}{11111100000100000100010001000011111} \DefineLCDchar{pi}{00000000001111101010010100101010011} \DefineLCDchar{sqrt}{00000000000011100100001001010001000} \DefineLCDchar{rect}{00000111111000110001100011000111111} \DefineLCDchar{fcur}{11111111111111111111111111111111111} \DefineLCDchar{lb}{00010001000010001000001000010000010} \DefineLCDchar{rb}{01000001000010000010001000010001000} \DefineLCDchar{alpha}{00000000000100110101100101001001101} % \end{macrocode} % % \noindent % The next characters normaly can't be typed dirctly, so the catcodes are % changed before defining them. % \begin{macrocode} \begingroup \catcode`\~=11 \catcode`\$=11 \catcode`\µ=11 \catcode`\°=11 \catcode`\·=11 \catcode`\ä=11 \catcode`\ö=11 \catcode`\ü=11 \catcode`\ß=11 \catcode`\"=11 \catcode`\#=11 \catcode`\&=11 \catcode`\^=11 \catcode`\_=11 \DefineLCDchar{$}{00100011111010001110001011111000100}%$ \DefineLCDchar{#}{01010010101111101010111110101001010} \DefineLCDchar{µ}{00000100011000110001100111110110000} \DefineLCDchar{°}{11100101001110000000000000000000000} \DefineLCDchar{·}{00000000000000001100011000000000000} \DefineLCDchar{ä}{01010000000111000001011111000101111} \DefineLCDchar{ö}{01010000000111010001100011000101110} \DefineLCDchar{ü}{01010000001000110001100011001101101} \DefineLCDchar{ß}{00000011101000111110100011111010000} \DefineLCDchar{"}{01010010100101000000000000000000000} \DefineLCDchar{&}{01100100101010001000101011001011101} \DefineLCDchar{^}{00100010101000100000000000000000000} \DefineLCDchar{_}{00000000000000000000000000000011111} \DefineLCDchar{~}{00000000000000000000000000000000000} \catcode`\%=11 \DefineLCDchar{%}{11000110010001000100010001001100011} \endgroup % \end{macrocode} % % ^^A--------------------------------------------- % \subsection{Registers needed} % \begin{macro}{\LCDunitlength} % The dimen |\LCDunitlength| is described in \ref{sec:size}. % \begin{macrocode} \newlength\LCDunitlength % \end{macrocode} % \end{macro} % % \begin{macro}{\c@@LCDdotx} % The counter |\c@@LCDdotx| is used to calculate and hold the horizontal % position of the actual dot. % \begin{macrocode} \newcounter{@LCDdotx} % \end{macrocode} % \end{macro} % % \begin{macro}{\c@@LCDdoty} % The counter |\c@@LCDdoty| is used to calculate and hold the vertical % position of the actual dot. % \begin{macrocode} \newcounter{@LCDdoty} % \end{macrocode} % \end{macro} % % \begin{macro}{\c@@LCDchrx} % The counter |\c@@LCDchrx| holds the number of the actual character in a line, % beginning with zero. % \begin{macrocode} \newcounter{@LCDchrx} % \end{macrocode} % \end{macro} % % \begin{macro}{\c@@LCDlines} % The counter |\c@@LCDlines| is used to check the number of lines and after % that the number of lines left to do is counted down there. % \begin{macrocode} \newcounter{@LCDlines} % \end{macrocode} % \end{macro} % % \begin{macro}{\c@@LCDlower} % The counter |\c@@LCDlower| is used to lower the LCD contents in normal text. % For |\LCD| it is set to zero, which means the contents isn't lowered. For % |\textLCD| it is set to two, so the baselines of LCD contents and surrounding % text will fit. % \begin{macrocode} \newcounter{@LCDlower} % \end{macrocode} % \end{macro} % % ^^A--------------------------------------------- % \subsection{Setups and Defaults} % \begin{macro}{\LCDframe} % \begin{macro}{\@LCDbox} % The macro |\LCDframe| (see \ref{sec:frame}) sets the internal macro % |\@LCDbox| to |\framebox|, so frames will be drawn. % \begin{macrocode} \newcommand*\LCDframe{\let\@LCDbox\framebox} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\LCDnoframe} % \begin{macro}{\@LCDbox} % The macro |\LCDnoframe| (see \ref{sec:frame}) sets the internal macro % |\@LCDbox| to |\makebox|, so frames will not be drawn. % \begin{macrocode} \newcommand*\LCDnoframe{\let\@LCDbox\makebox} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\LCDcolors} % \begin{macro}{\@LCDfr} % \begin{macro}{\@LCDfg} % \begin{macro}{\@LCDbg} % The macro |\LCDcolors| (see \ref{sec:color}) defines three internal macros. % |\@LCDfr| will be the framecolor, |\@LCDfg| will be the foregroundcolor and % |\@LCDbg| will be the backgroundcolor. % \begin{macrocode} \newcommand*\LCDcolors[3][black]{% \def\@LCDfr{#1}\def\@LCDfg{#2}\def\@LCDbg{#3}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \noindent % And now setting up the defaults. % \begin{macrocode} \setlength\LCDunitlength{0.5mm} \LCDframe \LCDcolors{black}{white} % \end{macrocode} % % \noindent % If the color package is not loaded the macros |\color| and |\colorbox| are % defined, because they are used in |\@LCDstart|. % \begin{macrocode} \AtBeginDocument{ \@ifundefined{color}{\def\color#1{}}{} \@ifundefined{colorbox}{\def\colorbox#1#2{#2}}{}} % \end{macrocode} % % ^^A--------------------------------------------- % \subsection{Drawing} % \begin{macro}{\@DrawLCDDot} % The macro |\@DrawLCDDot| draws a single dot of a character. % \begin{macrocode} \newcommand*\@DrawLCDDot{% \put(\the\c@@LCDdotx,\the\c@@LCDdoty.35){\line(1,0){0.7}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@DrawLCDRow} % The macro |\@DrawLCDRow| draws one dot line of a character. The parameters % are five zeros or ones from the character matrix (see \ref{sec:def}). % \begin{macrocode} \newcommand*\@DrawLCDRow[5]{% \def\@tempa{#1}\if\@tempa0\relax\else\@DrawLCDDot\fi\stepcounter{@LCDdotx}% \def\@tempa{#2}\if\@tempa0\relax\else\@DrawLCDDot\fi\stepcounter{@LCDdotx}% \def\@tempa{#3}\if\@tempa0\relax\else\@DrawLCDDot\fi\stepcounter{@LCDdotx}% \def\@tempa{#4}\if\@tempa0\relax\else\@DrawLCDDot\fi\stepcounter{@LCDdotx}% \def\@tempa{#5}\if\@tempa0\relax\else\@DrawLCDDot\fi \addtocounter{@LCDdotx}{-4}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@DrawLCDRows} % The macro |\@DrawLCDRows| draws all seven dot rows of a character. It is % first called with the complete character matrix (see \ref{sec:def}). The % first five zeros or ones will be the parameters |#1| to |#5|, which are passed % to |\@DrawLCDRow|. The parameter |#6| takes the rest of the character matrix. % |\@DrawLCDRows| is called recursively until the whole matrix is processed. % \begin{macrocode} \def\@DrawLCDRows#1#2#3#4#5#6\@@end{% \@DrawLCDRow#1#2#3#4#5\addtocounter{@LCDdoty}{-1}% \def\@tempa{#6}\ifx\@tempa\@empty\else\@DrawLCDRows#6\@@end\fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\@DrawLCDchar} % At first in |\@DrawLCDchar| the position of the upper left dot of the % character is calculated. Then |\@DrawLCDRows| is called with the already % expanded character matrix. The parameters are the position of the character % in x- (|#1|) and y-direction (|#2|) and the character to draw (|#3|). Note: % the positions of the characters are beginning with 0,0 in the lower left % corner. % \begin{macrocode} \newcommand*\@DrawLCDchar[3]{% \setcounter{@LCDdotx}{#1}\multiply\c@@LCDdotx 6\addtocounter{@LCDdotx}{2}% \setcounter{@LCDdoty}{#2}\multiply\c@@LCDdoty 10\addtocounter{@LCDdoty}{8}% \expandafter\expandafter\expandafter \@DrawLCDRows\csname @LCD@#3\endcsname\@@end} % \end{macrocode} % \end{macro} % % \begin{macro}{\@DrawLCDchars} % The macro |\@DrawLCDchars| draws all characters of a LCD-line. First spaces % are skiped. In |\c@@LCDchrx| the characters x-position is counted (beginning % with zero). |\@DrawLCDchars| is first called with the line positon (zero for % the lowest line) as parameter |#1| and the whole line text. Here the first % character becomes parameter |#2| and the rest parameter |#3|. % |\@DrawLCDchars| is called recursively with the line positon and the rest of % the line text until all characters are processed. % \begin{macrocode} \def\@DrawLCDchars#1#2#3\@@end{% \def\@tempa{#2}\if\@tempa\space\else\@DrawLCDchar{\the\c@@LCDchrx}{#1}{#2}\fi \stepcounter{@LCDchrx}% \def\@tempa{#3}\ifx\@tempa\@empty\else\@DrawLCDchars{#1}#3\@@end\fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\@DrawLCDLine} % In |\@DrawLCDLine| |\c@@LCDchrx| is set to zero and the initial call of % |\@DrawLCDchars| is done, but only if |#2| is not empty. The parameters % are the line position (|#1|) and the % complete line text (|#2|). % \begin{macrocode} \newcommand*\@DrawLCDLine[2]{% \def\@tempa{#2}\ifx\@tempa\@empty\else \setcounter{@LCDchrx}{0}% \@DrawLCDchars{#1}#2\@@end\fi} % \end{macrocode} % \end{macro} % % ^^A--------------------------------------------- % \subsection{Help Macros} % \begin{macro}{\if@textLCD} % \begin{macro}{\@textLCDtrue} % \begin{macro}{\@textLCDfalse} % In |\textLCD| the picture height is reduced by the height of the upper % border, otherwise there would be extra space over the actual line. But % the height of the box for colored background must not be reduced. % The boolean |\if@textLCD| is needed to distinguish if the background box % has to be corrected or not. % \begin{macrocode} \newif\if@textLCD % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\@LCDstart} % The macro |\@LCDstart| starts the picture environment, sets the colors, % draws the frame if wanted and fixes the height of the bachground box % if necessary. % \begin{macrocode} \newcommand*\@LCDstart{\unitlength\LCDunitlength \begin{picture}(\the\@tempcntb.7,\the\@tempcnta.7)(0,\the\c@@LCDlower) \color{\@LCDfr} \if@textLCD\advance\@tempcnta 2\fi \put(0,0){\fboxsep\z@\colorbox{\@LCDbg}{\@LCDbox(\the\@tempcntb.7,\the\@tempcnta.7){}}} \color{\@LCDfg} \linethickness{0.7\unitlength}} % \end{macrocode} % \end{macro} % % \begin{macro}{\@LCDend} % The macro |\@LCDend| only ends the picture environment. % \begin{macrocode} \newcommand*\@LCDend{\end{picture}} % \end{macrocode} % \end{macro} % % \begin{macro}{\do@LCDspecials} % The macro |\do@LCDspecials| sets new catcodes for the characters that % normaly can't be typed dirctly. % \begin{macrocode} \newcommand*\do@LCDspecials{% \catcode`\~=11 \catcode`\$=11 \catcode`\µ=11 \catcode`\°=11 \catcode`\·=11 \catcode`\ä=11 \catcode`\ö=11 \catcode`\ü=11 \catcode`\ß=11 \catcode`\"=11 \catcode`\&=11 \catcode`\#=11 \catcode`\^=11 \catcode`\_=11 \catcode`\%=11 \obeyspaces} % \end{macrocode} % \end{macro} % % \begin{macro}{\calc@LCDsize} % In |\calc@LCDsize| only the size of the picture environment is calculated. % \begin{macrocode} \newcommand*\calc@LCDsize[2]{\@tempcnta#1\multiply\@tempcnta10\relax \@tempcntb#2\multiply\@tempcntb6\advance\@tempcntb2\relax} % \end{macrocode} % \end{macro} % % ^^A--------------------------------------------- % \subsection{The Main Macros} % \begin{macro}{\textLCDcorr} % The macro |\textLCDcorr| provides the ability to change the default of the % first parameter of |\textLCD| to the user. Here it is defined to be the value % needed for white background. % \begin{macrocode} \newcommand*\textLCDcorr{-2} % \end{macrocode} % \end{macro} % % \begin{macro}{\textLCD} % Everything in |\textLCD| is done within a group (ended in |\@textLCD|), so % changes to registers, macros and catcodes are local. The parameters |#1| and % |#2| are described in \ref{sec:mac}. Parameter |#3| takes the first % \meta{delimchar}, needed to define |\@textLCD|. % % First, some setups are done here and |\LCDunitlength| is calculated so that % the height of \param{LCDtext} fits to the surrounding text. % \begin{macrocode} \newcommand*\textLCD[3][\textLCDcorr]{\begingroup \LCDnoframe\settoheight{\LCDunitlength}{M}% \setlength{\LCDunitlength}{0.146342\LCDunitlength}% \setcounter{@LCDlower}{2}\setcounter{@LCDlines}{1}% % \end{macrocode} % The first |\hspace| corrects the space before \param{LCDtext}, which will % always be to large without it. The second and the one at the end of % |\@textLCD| are needed to shrink the spaces around \param{LCDtext} if the % background color is white. % \begin{macrocode} \hspace{-.25em}\hspace{#1\LCDunitlength}% % \end{macrocode} % After calculating the picture size its height is reduced to prevent wrong % linespacing. % \begin{macrocode} \calc@LCDsize{1}{#2}\advance\@tempcnta-2\@textLCDtrue\do@LCDspecials % \end{macrocode} % \begin{macro}{\@textLCD} % Now |\@textLCD| can be defined so that the \meta{delimchar} (|#3|) denotes % the end of its parameter which is taken as \param{LCDtext}. The macro is % called at the very end of |\textLCD|, so its parameter begins with the first % character after the leading \meta{delimchar}. % \begin{macrocode} \def\@textLCD##1#3{\@LCDstart \@DrawLCDLine{0}{##1}\@LCDend\hspace{#1\LCDunitlength}\endgroup} \@textLCD} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\LCD} % Also in |\LCD| everything is done within a group (ended in |\@LCDlast|) to % keep changes to registers, macros and catcodes local, which are done for % setup. % % The parameters |#1| and |#2| are described in \ref{sec:mac}. Parameter |#3| % takes the first \meta{delimchar}, needed to define |\@LCD| and |\@LCDlast|. % \begin{macrocode} \newcommand*\LCD[3]{\begingroup \setcounter{@LCDlower}{0}\setcounter{@LCDlines}{#1}% % \end{macrocode} % Here the number of lines given is tested and corrected if necessary (and % other setups are done). % \begin{macrocode} \ifnum\c@@LCDlines<1\setcounter{@LCDlines}{1}\fi \calc@LCDsize{\c@@LCDlines}{#2}\@textLCDfalse\do@LCDspecials % \end{macrocode} % \begin{macro}{\@LCDlast} % Now |\@LCDlast| is defined so that the \meta{delimchar} (|#3|) denotes the % end of its parameter which is taken as \param{LCDtext}. It only handles the % last line. % \begin{macrocode} \def\@LCDlast##1#3{\@DrawLCDLine{0}{##1}\@LCDend\endgroup} % \end{macrocode} % \begin{macro}{\@LCD} % The macro |\@LCD| handles all lines expect the last. The number of lines left % to do are counted down here. Parameter |##1| is taken as \param{LCDtext}, % parameter |##2| takes everything between the ending \meta{delimchar} of an % LCD-line and the leading one of the next. Because |##2| is not used, things % between two LCD-lines are ignored. Note: due to the fact that |%| is catcoded % to 11 when calling |\@LCD|, comments are not possible. % \begin{macrocode} \def\@LCD##1#3##2#3{% \addtocounter{@LCDlines}{-1}\@DrawLCDLine{\c@@LCDlines}{##1} % \end{macrocode} % \begin{macro}{\@LCDnext} % If there is more then one line to process |\@LCDnext| is set to |\@LCD|, % else to |\@LCDlast|. % \begin{macrocode} \ifnum\c@@LCDlines>1\let\@LCDnext\@LCD\else \let\@LCDnext\@LCDlast\fi\@LCDnext} % \end{macrocode} % \begin{macro}{\@LCDnext} % Here |\@LCDnext| is set the first time. It's called at the very end of |\LCD|, % so the (first) parameter of |\@LCD| or |\@LCDlast| begins with the first % character after the leading \meta{delimchar}. % \begin{macrocode} \ifnum\c@@LCDlines>1\let\@LCDnext\@LCD\else\let\@LCDnext\@LCDlast\fi \@LCDstart\@LCDnext} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \Finale\endinput % % ^^A Now the source of the example %<*example> \documentclass[a4paper]{article} \usepackage[latin1]{inputenc} \usepackage{color} \usepackage{lcd} \parindent0pt \parskip1ex plus.3ex minus.2ex \pagestyle{empty} \newcommand\lcd{\textLCD{3}|LCD|} \newcommand\bs{\char '134 } \definecolor{lightgreen}{rgb}{0.05,0.97,0.55} \definecolor{darkgreen}{rgb}{0.22,0.26,0.19} \definecolor{lightblue}{rgb}{0.9,0.91,0.99} \definecolor{darkblue}{rgb}{0.14,0.2,0.66} \definecolor{lightred}{rgb}{1.0,0.27,0.37} \definecolor{darkred}{rgb}{0.37,0.14,0.18} \DefineLCDchar{euro}{00111010001111101000111110100000111} \begin{document} \centerline{\textbf{\LARGE Some Examples for the \lcd\ package.\footnote{The source of this example file is part of \texttt{lcd.dtx}.}}} As seen in the headline and here, the \lcd\ package calculates the size for LCD-text in normal text (\verb|\textLCD|) automaticly. It works for all fontsizes: \begin{center} {\tiny MM M \lcd\ M MM tiny}\hfill{\Huge Huge MM M \lcd\ M MM} {\scriptsize MM M \lcd\ M MM scriptsize}\hfill{\huge huge MM M \lcd\ M MM} {\footnotesize MM M \lcd\ M MM footnotesize}\hfill{\LARGE LARGE MM M \lcd\ M MM} {\small MM M \lcd\ M MM small}\hfill{\Large Large MM M \lcd\ M MM} {\normalsize MM M \lcd\ M MM normalsize}\hfill{\large large MM M \lcd\ M MM} \end{center} Now let's have some colored \LCDcolors{darkgreen}{lightgreen}\textLCD[0]{8}|LCD-text|. Here first the colors where set with \verb|\LCDcolors{darkgreen}{lightgreen}|\footnote{The color names where defined with \texttt{\bs definecolor} from the \textsf{color} package in the preamble.} and then the LCD-text where done with \verb+\textLCD[0]{8}|LCD-text|+. To invert the LCD, just exchange the \LCDcolors{lightgreen}{darkgreen}\textLCD[0]{6}|colors| (\verb|\LCDcolors{lightgreen}{darkgreen}|). \begin{minipage}[t]{.5\textwidth} Now some seperate LCD representations. But first let's change the colors to some not as ugly. The LCD was generated with \begin{verbatim} \LCD{4}{18}|LCD representation| |made with the LCD | |package for LaTeX | |04.01.2004 {clock} 18:23| \end{verbatim} \end{minipage} \hspace{\fill} \begin{minipage}[t]{.46\textwidth} \mbox{} \LCDcolors{darkblue}{lightblue}% \LCD{4}{18}|LCD representation| |made with the LCD | |package for LaTeX | |04.01.2004 {clock} 18:23| \end{minipage} The \verb|{clock}| is a so called multi-letter character. It generates the clock symbol. As you can see, there is a black colored frame around it. The frame color can be changed with the optional first argument of \verb|\LCDcolors| (\verb|\LCDcolors[red]|\ldots; left part of figure 1). And with \verb|\LCDnoframe| you can disable frames (reenabled with \verb|\LCDframe|; right part of figure 1). Of course \verb|\LCD| works within a figure environment. \begin{figure}[h] \LCDcolors[red]{darkblue}{lightblue}% \LCD{4}{18}|LCD representation| |made with the LCD | |package for LaTeX | |04.01.2004 {clock} 18:45| \hspace{\fill}\LCDnoframe \LCD{4}{18}|LCD representation| |made with the LCD | |package for LaTeX | |04.01.2004 {clock} 18:47| \caption{Example with red colored frame and without frame} \end{figure} \LCDcolors[lightgreen]{lightred}{darkred}\LCDframe \LCD{2}{36}|For more information please refer to| |the documentation! | \end{document} %