Kt Macro Coich01

download Kt Macro Coich01

of 11

Transcript of Kt Macro Coich01

  • 8/12/2019 Kt Macro Coich01

    1/11

    Ky thu .t nh

    ,

    o trong LATEXM .t s Macro co ch (1)

    Nguyn Hu,

    u i,

    n

    Khoa Toan - Co,

    - Tin h .oc

    HKHTN Ha N .i, HQGHN

    M .uc l .uc

    1 Gio,

    i thi .u 1

    2 Cac macro co ch 1

    2.1 Nng chu,

    cheo trn m .t dong . . . . . . . . . . . . . . . . . . . . . . . 1

    2.2 anh cheo vung ho .ac khng . . . . . . . . . . . . . . . . . . . . . . 2

    2.3 Lam thu,

    o,

    c k,

    e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    2.4 Cu trch dn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    2.5 anh du c .ng khac nhau . . . . . . . . . . . . . . . . . . . . . . . . . 5

    2.6 Lam chu thch b,

    ang va hnh khng co mi tru,

    o,

    ng d .ng . . . . . . . . . . 6

    2.7 B,

    an t,

    ng kt chm di,

    m . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    2.8 ,

    trng din bai lam cu h,

    oi . . . . . . . . . . . . . . . . . . . . . . . 8

    2.9 .inh ngha m .t khi . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

    2.10 u,

    a nhu,

    ng mi tru,

    o,

    ng cng thu,

    c ln cac tiu d chu,

    o,

    ng ho .ac do .an . . . 11

    1 Gio,

    i thi .u

    ,

    ch,

    nh van b,

    an trong LATEX cho d .ep co rt nhiu ky thu .t vvi .c nay, v d .u dung phng,

    dung cac l .nh co san ho .ac xy d .u

    ,

    ng l .nh d,

    lam vi .c do cho thch h .o,

    p. Lo .at bai noi v

    ky thu .t trong LATEX ti tm toi va trnh by nhu,

    ng vn d nu bit th qua d khi lam cho

    van b,

    an d .ep. Ky thu .t qua do,

    n gi,

    an nhiu khi ngu,

    o,

    i dung khng d,

    y va ap d .ung no.

    1

  • 8/12/2019 Kt Macro Coich01

    2/11

    hp://nhdien.wordpress.com -Nguy n H u,

    u i,

    n 2

    2 Cac macro co ch

    Rt nhiu macro d.inh ngha m .t l .nh t .ao ra m .t d.inh d .ang d .ep khng co trong goi l .nh

    nao. Khi dung th ch,

    cn chep vao phn du va s,

    u,

    d .ung no la du,

    .o,

    c, khng cn goi l .nhkem theo. Ti thu th .p cac macrro d

    ,

    khi cn th s,

    u,

    d .ung t .ao ra van b,

    an ring bi .t.

    2.1 Nng chu,

    cheo trn m .t dong

    \newcommand{\vcorr}[2][1]{%

    \begingroup

    \tabcolsep=.5\tabcolsep

    \sbox0{%

    \begin{tabular}[b]{@{}|l}%

    #2%\tabularnewline

    \hline

    \end{tabular}%

    }%

    \settoheight{\dimen0 }{%

    \rotatebox{45}{%

    \copy0 %

    \kern-\tabcolsep

    }%

    }%\rule{0pt}{#1\dimen0}%

    \setlength{\wd0 }{1em}%

    \setlength{\ht0 }{1em}%

    \rotatebox{20}{\usebox{0}}%

    \endgroup

    }

    Xin chao th gio,

    i, \\

    y la nng \vcorr{cheo ln

    m.t chut} ma co ai dung.\\y la \vcorr[.9]{Tuy ch.on \\

    nng l} B.an mun g.

    Xin chao th gio,

    i,

    y la nng cheo

    lnm.tc

    hut

    ma co ai dung.

    y la

    T`uych.on

    nngl

    B .an mun g.

  • 8/12/2019 Kt Macro Coich01

    3/11

    hp://nhdien.wordpress.com -Nguy n H u,

    u i,

    n 3

    Tr,

    o,

    l .ai m .uc l .uc [1]

    2.2 anh cheo vung ho.ac khng

    \def\stepyesno#1{%

    \if x#1\boxtimes\else

    \if o#1\square\else

    \let\stepyesno #1\fi\fi

    \stepyesno

    }

    \newcommand\yesno[1]{$\stepyesno#1$}

    \yesno{x}

    \yesno{xxo}

    \yesno{xxoooxx}

    Tr,

    o,

    l .ai m .uc l .uc [1]

    2.3 Lam thu,

    o,

    c k,

    e

    \setlength{\unitlength}{1mm}

    \newsavebox{\Ruler}\savebox{\Ruler}{%

    \begin{picture}(10,2)(0,0)

    \put(0,0){\line(1,0){10}}

    \multiput(0,0)(5,0){3}{\line(0,1){1.5}}

    \multiput(1,0)(1,0){4}{\line(0,1){1}}

    \multiput(6,0)(1,0){4}{\line(0,1){1}}

    \end{picture}}

    y la 1cm \usebox{\Ruler}

    \usebox{\Ruler}\usebox{\Ruler}\usebox{\Ruler}

    y la 1cm

    \setlength\unitlength{1truecm}

    \begin{picture}(10,1)

    \put(0,0){\line(1,0){9}}

    \multiput(0,0)(1,0){10}{\line(0,1){0.7}}

    \multiput(0,0)(0.5,0){18}{\line(0,1){0.5}}

    \multiput(0,0)(0.1,0){90}{\line(0,1){0.3}}

    \end{picture}

  • 8/12/2019 Kt Macro Coich01

    4/11

    hp://nhdien.wordpress.com -Nguy n H u,

    u i,

    n 4

    Tr,

    o,

    l .ai m .uc l .uc [1]

    2.4 Cu trch dn

    V,

    e d .ep c,

    ua Toan h .oc cung nhu,

    c,

    ua m .oi

    v .t khac ch,

    co th,

    c,

    am nh .n chu,

    khng

    gi,

    ai thch du,

    .o,

    c

    Cayley

    1. Macro co tac d .ung sau tiu d chu,

    o,

    ng ho .ac sau m .t do .an:

    \newcommand{\trichdan}[2]{\vspace{.5\baselineskip}\begin{flushright}\small

    \begin{minipage}{2.5in}

    \begin{minipage}{2.5in}\begin{flushleft} #1\\

    \rule[.5ex]{2.5in}{.4pt}

    \end{flushleft}\end{minipage} \\

    \begin{minipage}{2.5in}\begin{flushright} #2

    \end{flushright}\end{minipage}

    \end{minipage}\end{flushright}\vspace{.5\baselineskip}}

    \trichdan{V,

    e .ep c,

    ua Toan h.oc cung nhu,

    c,

    ua m.oi v.t khac ch,

    co th,

    c,

    am nh.n chu,

    khng gi,

    ai thch u,

    .o,

    c}

    {Cayley\footnote{Arthur Cayley (1821-1895) Nha toan h.oc Anh.}}

    V,

    e d .ep c,

    ua Toan h .oc cung nhu,

    c,

    ua m .oi

    v .t khac ch,

    co th,

    c,

    am nh .n chu,

    khng

    gi,

    ai thch du,

    .o,

    c

    Cayleya

    aArthur Cayley (1821-1895) Nha toan h .oc

    Anh.

    2. Khng co dong k,

    e ,

    o,

    du,

    o,

    i va dung nhu,

    mi tru,

    o,

    ng

  • 8/12/2019 Kt Macro Coich01

    5/11

    hp://nhdien.wordpress.com -Nguy n H u,

    u i,

    n 5

    \newcommand{\nicequoteauth}{}

    \newenvironment{nicequote}[1]

    {\renewcommand{\nicequoteauth}{#1}%

    \par\bigskip\begin{flushright}\small\begin{minipage}{2.5in}\itshape}

    {\end{minipage}\par\nobreak\medskip

    --- \nicequoteauth\end{flushright}\par\bigskip}

    \begin{nicequote}{\textbf{Cayley}}

    V,

    e .ep c,

    ua Toan h.oc cung nhu,

    c,

    ua m.oi v.t khac ch,

    co th,

    c,

    am nh.n chu,

    khng gi,

    ai thch u,

    .o,

    c.

    \end{nicequote}

    V,

    e d.ep c,

    ua To an h.oc c ung nhu,

    c,

    ua m.oi v.t

    kh ac ch,

    c o th,

    c,

    am nh.n ch u,

    khng gi,

    ai

    thch du,

    .o,

    c.

    Cayley

    Tr,

    o,

    l .ai m .uc l .uc [1]

    2.5 anh du c .ng khac nhau

    \newcommand{\cmd}[1]{\texttt{\def\{{\char\{}\def\}{\char\}}$\backslash$#1}}

    \newcommand{\PL}{\scriptsize\tt\char"2B}

    \newcommand{\PLS}{\tiny\tt\char"2B}

    \begin{center}

    \begin{tabular}{|l|ccccc|}

    \hline

    &1&2&3&4&5\\

    \hline

    \cmd{tiny}&{\tiny +}&{\tiny ++}&{\tiny +++}&

    {\tiny ++++}&{\tiny +++++}\\

    \cmd{texttt}+\cmd{scriptsize}&\PL&\PL\PL&

    \PL\PL\PL&\PL\PL\PL\PL&\PL\PL\PL\PL\PL\\

    \cmd{texttt}+\cmd{tiny}&\PLS&\PLS\PLS&

    \PLS\PLS\PLS&\PLS\PLS\PLS\PLS&\PLS\PLS\PLS\PLS\PLS\\

    \hline

    \end{tabular}

    \end{center}

  • 8/12/2019 Kt Macro Coich01

    6/11

    hp://nhdien.wordpress.com -Nguy n H u,

    u i,

    n 6

    1 2 3 4 5

    \tiny + ++ +++ ++++ +++++\texttt+\scriptsize + ++ +++ ++++ +++++\texttt+\tiny + ++ +++ ++++ +++++

    Tr,

    o,

    l .ai m .uc l .uc [1]

    2.6 Lam chu thch b,

    ang va hnh khng co mi tru,

    o,

    ng d .ng

    1. .at ,

    o,

    phn du macrro:

    \makeatletter

    \newcommand{\tblcaption}[1]{\def\@captype{table}\caption{#1}}\newcommand{\figcaption}[1]{\def\@captype{figure}\caption{#1}}

    \renewcommand{\thetable}{%

    \thesection.\arabic{table}}

    \@addtoreset{table}{section}

    \renewcommand{\thefigure}{%

    \thesection.\arabic{figure}}

    \@addtoreset{figure}{section}

    \makeatother

    2. Khi dung b,

    ang va hnh trong b,

    angd,

    cn b `ang khng dung mi tru,

    o,

    ng d .ngdu,

    .o,

    c. Ch,

    co cach dung macrro trn d,

    danh s tip.

    \begin{tabular}{p{0.45\textwidth}p{0.1\textwidth}p{0.3\textwidth}}

    \centering

    \begin{tabular}[b]{|c|c|}

    \hline

    1&2\\ \hline

    3&4\\

    \hline

    \end{tabular}

    \tblcaption{B,

    ang v d.u m

    .t bn}

    \label{tbl:left}

    &&

    \centering\includegraphics*[width=.5cm,keepaspectratio,clip]{dhkhtnhn}

    \figcaption{Hnh m.t bn}

    \label{fig:bear}

    \end{tabular}

    Xem Hnh \ref{fig:bear} va B,

    ang \ref{tbl:left}

  • 8/12/2019 Kt Macro Coich01

    7/11

    hp://nhdien.wordpress.com -Nguy n H u,

    u i,

    n 7

    1 2

    3 4

    B,

    ang 2.1: B,

    ang v d .u m .t bn Hnh 2.1: Hnh m .t bn

    Xem Hnh2.1 va B,

    ang2.1

    \begin{tabular}{p{0.45\textwidth}p{0.1\textwidth}p{0.3\textwidth}}

    \centering\includegraphics*[width=2cm,keepaspectratio,clip]{dhkhtnhn}

    \figcaption{Hnh phong to}

    \label{fig:bear2}

    &&

    \centering\begin{tabular}[b]{|c|c|c|c|}

    \hline

    1&2&3&4\\

    \hline

    11&12&13&14\\

    \hline

    \end{tabular}

    \tblcaption{B,

    ang mo,

    i}

    \label{tbl:left2}

    \end{tabular}

    Xem Hnh \ref{fig:bear2}

    Hnh 2.2: Hnh phong to

    1 2 3 4

    11 12 13 14

    B,

    ang 2.2: B,

    ang mo,

    i

    Xem Hnh2.2

    Tr,

    o,

    l .ai m .uc l .uc [1]

    2.7 B,

    an t,

    ng kt chm di,

    m

    \newcounter{points}

  • 8/12/2019 Kt Macro Coich01

    8/11

    hp://nhdien.wordpress.com -Nguy n H u,

    u i,

    n 8

    \newcommand{\descript}[2][]{%

    \fbox{\parbox{8cm}{#1}}\quad\fbox{#2}

    \addtocounter{points}{#2}

    \newline\vskip 1ex }

    \newcommand{\totalsum}{%

    \addtocounter{points}{-1}

    \refstepcounter{points}

    \label{pnt}}

    \newcommand{\printtotalsum}{%

    T,

    ng s i,

    m \textbf{\ref{pnt}}

    \newline\vskip 1ex}

    \printtotalsum%

  • 8/12/2019 Kt Macro Coich01

    9/11

    hp://nhdien.wordpress.com -Nguy n H u,

    u i,

    n 9

    2.8 ,

    trng din bai lam cu h,

    oi

    \makeatletter

    \newlength\linefillheight\newlength\linefillthickness

    \setlength\linefillheight{.25in}

    \setlength\linefillthickness{0.1pt}

    \newcommand\linefill{\leavevmode

    \leaders\hrule height \linefillthickness \hfill\kern\z@}

    \def\fillwithlines#1{%

    \begingroup

    \ifhmode

    \par\fi

    \hrule height \z@

    \nobreak

    \setbox0=\hbox to \hsize{\hskip \@totalleftmargin

    \vrule height \linefillheight depth \z@ width \z@

    \linefill}%

    \cleaders \copy0 \vskip #1 \hbox{}%

    \endgroup

    }

    \makeatother

    \begin{enumerate}

    \item Cho $y = (3x^{2} - 5x)^{5}$, tnh $\dfrac{dy}{dx}$.

    \fillwithlines{1in}

    \item Cho $f(x) = x \e^{3x}$, tnh gia tr.i $f(0)$.

    \fillwithlines{2in}

    \end{enumerate}

    1. Choy= (3x2 5x)5, tnh dy

    dx.

  • 8/12/2019 Kt Macro Coich01

    10/11

    hp://nhdien.wordpress.com -Nguy n H u,

    u i,

    n 10

    2. Chof(x) =xe3x, tnh gia tr.i f(0).

    Tr,

    o,

    l .ai m .uc l .uc [1]

    2.9 .inh ngha m .t khi

    \newlength{\indentamount}

    \newcommand{\doalignafter}{%

    \everypar{%

    \hangafter=0

    \hangindent=\indentamount

    }%

    }

    \newenvironment{alignafter}[1]{%

    \global\settowidth{\indentamount}{\mbox{#1}\quad}%

    \everypar{\doalignafter}

    \parindent=0pt

    \parskip=\baselineskip

    \hangafter=1

    \hangindent=\indentamount

    \mbox{#1}\quad

    \ignorespaces

    }{%

    \strut\par

    }

    \begin{alignafter}{\textbf{B ai t.p:}}

    Tm tt c,

    a cac c.p s nguyn $\left(x,y\right)$ sao cho $1+1996x+1998y=xy$

    Tm tt c,

    a cac c.p s nguyn $\left(x,y\right)$ sao cho $1+1996x+1998y=xy$

    \end{alignafter}

    \begin{alignafter}{\textbf{D .inh ngha:}}

    Hai c.ng hai bng bn.

  • 8/12/2019 Kt Macro Coich01

    11/11

    hp://nhdien.wordpress.com -Nguy n H u,

    u i,

    n 11

    Hai c.ng hai bng bn.

    Hai c.ng hai bng bn.

    Hai c.ng hai bng bn.

    \end{alignafter}

    Bai t .p: Tm tt c,

    a cac c .ap s nguyn(x, y)sao cho1 + 1996x+ 1998y= xy Tm

    tt c,

    a cac c .ap s nguyn(x, y) sao cho1 + 1996x+ 1998y= xy

    D.inh ngha: Hai c .ng hai b`ang bn. Hai c .ng hai b

    `ang bn. Hai c .ng hai b`ang bn.

    Hai c .ng hai b`ang bn.

    Tr,

    o,

    l .ai m .uc l .uc [1]

    2.10 u,

    a nhu,

    ng mi tru,

    o,

    ng cng thu,

    c ln cac tiu d chu,

    o,

    ng ho .ac

    do .an

    Dung l .nh\protecttru,

    o,

    c cac l .nh mi tru,

    o,

    ng:

    \chapter{Ma tr.n $\protect\begin{vmatrix}

    a_{11} &a_{12} \\

    a_{21} &a_{22}+b_{12}

    \protect\end{vmatrix}$ trn u chu,

    o,

    ng}

    \section{Cng thu,

    c $

    \lvert x \rvert

    = \protect\begin{cases}

    x & \text{$x \ge 0$} \\

    -x & \text{Nguoc lai}

    \protect\end{cases}

    $}

    Tr,

    o,

    l .ai m .uc l .uc [1]