KTUGFaq

KTUG FAQ

α:
йȣ:
If you suspect a man, don't employ him.
LaTeXPix&value=Yhchoe/FindPageKTUGCollection2006&value=Yhchoe/TitleIndexKC2008/KCmenuKC2006/ó/TroubleShooting/TroubleShooting&value=KC2006/ó/TroubleShooting/TroubleShooting歐/HLaTeX&value=은글꼴 › TeX

1 TeX
1.1
1.2
1.3
1.4
2 LaTeX
2.1 \newcounter, \setcounter
2.2 calc Ű
2.2.1
2.2.2 Ǽǥø
3 Ǽ 䳻 : realcalc.tex

TeX Ҽ Ѵ. ؿ (integer) ִ.

[]

1 TeX

counter dimension ؼ .
  • counter \count register ϵ Ʈ Ų. TeX 256(255) count register ִ. PlainTeX ǵ \newcount ʴ count register ڵҴϿ \countdef θ ũ̴. counter ؼ Ѵ.
  • dimension ̴̰. dimension ؼ Ǽ Ѵ.

[]

1.1

\advance _variable_ by _number_
by ִ.
\newcount\mycnt\mycnt=1
\newdimen\mydim\mydim=10pt
\advance\mycnt by1\advance\mydim by10.1pt
\the\mycnt\quad\the\mydim
\newcount\mycnt\mycnt=1
\newdimen\mydim\mydim=10pt
\advance\mycnt by1\advance\mydim by10.1pt
\the\mycnt\quad\the\mydim

[]

1.2

\multiply _variable_ by _number_
by ִ.

$$2^{30}$$ .
\newcount\mycnt\mycnt=1
\newdimen\mydim\mydim=10.24pt
\multiply\mycnt by4\multiply\mydim by2
\the\mycnt\quad\the\mydim
\newcount\mycnt\mycnt=1
\newdimen\mydim\mydim=10.24pt
\multiply\mycnt by4\multiply\mydim by2
\the\mycnt\quad\the\mydim

dimen ϴ counter̴.

[]

1.3

\divide _variable_ by _number_
by .

\newcount\mycnt\mycnt=5
\newdimen\mydim\mydim=10.24pt
\divide\mycnt by3\divide\mydim by3
\the\mycnt\quad\the\mydim
\newcount\mycnt\mycnt=5
\newdimen\mydim\mydim=10.24pt
\divide\mycnt by3\divide\mydim by3
\the\mycnt\quad\the\mydim

counter , . , ޵ȴ.

̿Ͽ, Ư ڸ, 13 ڸ 3 ϴ ƾ غ.
\count@\TmpInt
\ifnum\count@<\z@ \count@-\count@ \fi\count2\count@
\divide\count2 10 \multiply\count2 10 \advance\count@-\count2
\TmpInt ޾Ƶ鿩 \count2 Ͽ. ׷ , 10 ٽ 10 Ͽ (10) ڸ ̴. ׷ 1 ڸ 3 ´. ƾ HLaTeX ڵ縦 óϱ ä ̱⵵ ϴ.

[]

1.4

̿ؼ ִ ϴ ũԴϴ. ִ ϴ ˰ Ŭ ˰ ߽̿ϴ.
\newcount\m \newcount\n \newcount\t

\def\euclid#1#2{\m=#1 \n=#2
  \ifnum\n>\m \t=\m \m=\n \n=\t \fi
  \ifnum\n=0 \number\m
  \else\t=\m \divide\m\n \multiply\m\n \advance\t-\m \euclid\n\t \fi}

̿մϴ.

\newcount\m \newcount\n \newcount\t

\def\euclid#1#2{\m=#1 \n=#2
  \ifnum\n>\m \t=\m \m=\n \n=\t \fi
  \ifnum\n=0 \number\m
  \else\t=\m \divide\m\n \multiply\m\n \advance\t-\m \euclid\n\t \fi}
    
The greatest common divisor of $119$~and~$544$ is $\euclid{119}{544}.$

The greatest common divisor of $2166$~and~$6099$ is $\euclid{2166}{6099}.$
Ʒ ԴѴ.

The greatest common divisor of $119$~and~$544$ is $\euclid{119}{544}.$
The greatest common divisor of $2166$~and~$6099$ is $\euclid{2166}{6099}.$

[]

2 LaTeX

[]

2.1 \newcounter, \setcounter

\newcounter ο ī Ѵ. PlainTeX \newcount LaTeX Ư δ. , Ϲ \csname شϴ \ ī ν, Ŀ ϰ Ϸ Ͽ.
\documentclass{article}
\usepackage{hfont}
\usepackage{ifthen}

\begin{document}
%% newcounter
\newcounter{ddd}        % LaTeX . ī  ddd 
\newcount\dddd  % PlainTeX . ī  \dddd 

%% setcounter
\setcounter{ddd}{0}     % LaTeX 
\dddd=0                 % PlainTeX 

%% ī ϳ Ű
\stepcounter{ddd} %      īͿ 1 Ѵ.(LaTeX)
\advance\dddd by 1%      īͿ 1 Ѵ.(PlainTeX)

\addtocounter{ddd}{3}%   īͿ 3 Ѵ.(LaTeX)
\advance\dddd by 3%      īͿ 3 Ѵ.(PlainTeX)

%% ǥ(LaTeX)
\arabic{ddd}
\Alph{ddd}
\alph{ddd}
\Roman{ddd}
\roman{ddd}

%%  
\theddd         % LaTeX   ddd ī͸ θ 
\number\dddd    % PlainTeX   dddd ī͸ θ . \the\dddd .

%%    Right ȴ.
\ifthenelse{\equal{\value{ddd}}{\theddd}}
        {Right}{Wrong}

%% \dddd ϳ Ű.(ddd=4, \the\dddd=5)
\advance\dddd by 1

%% 翬   ٸ ̴.
\ifthenelse{\equal{\value{ddd}}{\the\dddd}}
        {Right}{Wrong. \theddd\ is not equal to \the\dddd}

\end{document}

[]

2.2 calc Ű

TeX ɵ \advance, \multiply ܻ(end-user) ⿡ ʹ ϴ. LaTeX calc Ű Ͽ ϵ ϰ ִ. Counter(Number) Dimension  ȴ.
<!> Dimension̶ ̴ ٴ ̺ Ų.
  • \newcounter, \setcounter Ͽ Ǵ counter()
  • \newlength, \setlength Ͽ Ǵ dimension(Ǽ)
  • \widthof, \heightof, \depthof Ͽ text box ũ(Ǽ)
  • []

    2.2.1

    1. $$+$$
    2. $$-$$
    3. $$*$$
    4. $$/$$
    []

    2.2.2 Ǽǥø

    1. \real
    2. \ratio
      <!> counter 꿡 Ҽ κ . \setcounter{x}{3*\real{1.6}} ī x 4 Ҵ ̴.

    []

    3 Ǽ 䳻 : realcalc.tex


    LaTeX dimension Ͽ Ǽ calc Ű Ͽ , TeX/LaTeX Ϲ Ǽ ǻ ſ ƴ.

    ⿡ Ұϴ realcalc.tex Frank Bochholz PlainTeX ̽ Űμ, Ǽ ó ξ. ٷ ִ -2147483647.999999999 2147483647.999999999̰, Ǿ , Ǽ ʿ ̴.( Ҽ ٲپ ؾ ̴.) LaTeX ̴.

    \documentclass{article}
    \input realcalc
    
    \def\a{2.550}
    \def\b{3.660}
    \parindent=0pt
    
    \begin{document}
    
    \verb|\a|=\a \quad \verb|\b|=\b
    
    \begin{tabular}{cc}
    add &
    \Radd\c\a\b
    \Rtrunc\c2\c
    \Rtrunc\a2\a
    \Rtrunc\b2\b
    \c \verb|=| \a \verb|+| \b
    \\
    
    subst &
    \Rsub\d\a\b
    \Rtrunc\d2\d
    \d
    \\
    
    multiply &
    \Rmul\e\a\b
    \Rtrunc\e2\e
    \e
    \end{tabular}
    
    \end{document}
    


    Contributors : Karnes


    ^
    Valid XHTML 1.0! Valid CSS! powered by MoniWiki
    last modified 2007-02-07 22:56:21
    Processing time 0.0651 sec