KTUGFaq
KTUG FAQ
A truly wise man never plays leapfrog with a Unicorn.
PDFSlide&value=DVI̹ › TeX4ht&value=TeX4ht/FindPage › WinEdtTip/EmEditor�Բ�����&value=WinEdtTip/α › 占십몌옙占쏙옙占쏙옙占쏙옙占쏙옙見占 › CategoryGraphics&value=PDF › emacsϱ
Emacs ſ editor̳ ϰ ٰ ϴ Ⱑ ƴٴ ִ. WindowXP(Ȯ ϸ KTUGCollection2006) ̻ 鼭 ٽ ѹ Ѵ.
1 Emacs ؼ 켱 ؾ ͵ ¶
Emacs ó Ǿ keyboard AŰ Caps LockŰ ڸ CtrlŰ ־, ~Ű ڸ AltŰ ־ٰ Ѵ. LaTeX ϴٰ ~Ű , Caps LockŰ .( Windows 鼭 Ǿ.) http://youlsa.com/2005/09/08/51/ site downƼ ġϸ Caps LockŰ CtrlŰ ٲټ ִ. ƹ پ ϰ ۾ ִ. WindowXP systemü ٲ , Emacsο ٲܼ ѵ, ڽϴ.
2 ܿ ͵ ¶
* Ʒ Ű Է http://wiki.kldp.org/wiki.php/EmacsGdbEtagsCscope Դϴ. żԲ 帳ϴ.
C-x C-f control key ¿, `x' (control key ʰ) `f' . C-x o control key ¿, `x' (control key ) `o' . C-_ control key ¿ `_'() . M-x compile<RET> meta key `x' (meta key ) `compile' ġ <RET> .
, Emacs Ű, "C-h t" tutorial о ٶ. tutorial , Ʒ Ű ݵ ܿ ͼϰ ˾ƾ ϴ Ű̹Ƿ ܿ ٶ:
- C-x C-c Emacs C-v M-v C-l â κ C-p Ŀ up C-n Ŀ down C-f Ŀ right C-b Ŀ left C-a Ŀ ó C-e Ŀ M-f ܾ M-b ܾ C-d M-d ܾ C-k Ŀ ġ C-<SPC> Ŀ ġ ũ(mark)ϱ M-w ũ Ŀ ġ (copy) C-w ũ Ŀ ġ (cut) C-y ٿ ֱ(paste) C-_ undo C-g Է (undo ƴ) C-x C-s ϱ(save) C-x C-w ٸ ̸ ϱ(save as...) C-x C-f ҷ(load) C-x C-k (kill) C-x b ۷ ȯ C-x C-b ֱ C-x 2 â ΰ C-x 1 â ٸ â ݱ C-x o ٸ â Ŀ ̵
3 ¶
Ư ܾ ؼ ֵ Ѵ. 忡 Ʋ ̳ ܾ ִ 쿡 ڸ Ȯ ܾ ٲپ ִ ɵ ִ. δ Ҷ ܾü ǹ̸ ϰų ȮDZ⸦ ʴ ܾ ƾ Ѵ. World Association for Replicant Technology Ͽ wart ʴ . wartü ǹ̷ ϱؼ M-x unexpand-abbrev RETRUN̿ؼ ִ.
3.2 Ҷ ϱ ¶
- .emacs Ͽ ´.
(setq-default abbrev-mode t) (read-abbrev-file "~/.abbrev_defs") (setq save-abbrevs t)
4 ܾ ּ ڵ Է ¶
http://wiki.kldp.org/wiki.php/EmacsDynamicAbbrevExpand Խϴ. ڼ site Ȯϼ. Emacs , ۿ ܾ , ܾ ù Ϻκи Էص ڵ Էִ ֽϴ. ڵ ſ ϳԴϴ. M-x dabbrev-expand , κ M-/ ֽϴ. ɹ ϳ ְ Ŀ ʿ ¥ Ϻθ typingĿ M-/ . Ÿ text Է ֽϴ.
5 ¶
å, , ۼϸ鼭 ü ľϱ ̴. 並 幮 ε巴 ϰų, ϸ鼭 籸ϴ ϴ. ٴ ǹ̴. ̶ 忡 ذå Ѵ. KTUGCollection2006 emacsġ Դϴ. θ ġ 쿡 ̴.
C-c @ C-t (hide body) ؽƮ ִ. C-c @ C-a (show all) ̵ ̵ ǥѴ. C-c @ C-d (hide subtree) (section or subsection) Ϻΰ ȣ (...) ü C-c @ C-s (show subtree) ȣ Ÿ.
- pop-up menu ɰ
6.1 켱 ⺻ ¶
^ ó ã´ $ ã´ ? ڳ 0 Ǵ 1ȸ ݺѴ. . ڸ ã´ .* ̰ 0̻ ڿ ã´ \< ܾ ó ã´ \> ܾ ã´ [] ȣ ǵ ڿ , [a-z] ĺ ҹڸ ǹѴ \\( \\) \\| \\| ̳ ǥĿ Ѵ.
Ϲ egrep ū
- * ̴. egrep *ڰ ڿ ǹ emacs .* Ѵ
- 쿬 () ð ΰ ٴ ̴. ̷ ð ⺻ ǥ ̿ܿ Ư ڰ ϱ ø Ѵٰ Ѵ.(?)
6.2 ( command ȯ ٲٱ) ¶
, command ٲ ȯ ٲٰ ʹٰ . ̰ ׳ simple search & replace ٲٱ ʴ. \mycommand{text}
\begin{myenv} text \end{myenv} ؾ ϴ Ȳ ִٸ ĥΰ?
- غ. command ִ ڰ ϳ̰ ȿ ٸ command ̴. text ̴. C-M-% Էϰų, Emacs Edit->Replace->Replace Regexp ؼ mycommandκ ְ, Ŀ myenvκ ִ´.
\\\mycommand{\(.*?\)} -> \\begin{myenv} \1 \\end{myenv}
- ָ ǥ ڷ Ǵ ڸ Ÿ ؼ ΰ տ ξ Ѵ. \\\mycommand ΰ ô 3° ð ǥ ڰ ƴ϶ Ÿ̴. ι° \1 ڷ groupingϴ \(.*?\) ̴. KTUG Wiki Խ ڸ Ἥ matching õ Ѱ̴. ٸ replacement string ΰ ø Replacement string LISP Ͱ ؼ Ѵٰ մϴ. ( ....) ۵ ϴϱ? ؼ...
- ڰ 2 ̻̰ տ ٸ ɹ
6.3 ( Wikipage LaTeX file ) ¶
ֱٿ wikipage ؼ LaTeX Ͽٴ ҹ , ⼭ source Ƽ tex ٲٴ ؼ ڴ.
- source м(?)̴. wiki page Ǿ ־ ִ ͵ λ縻, tableofcontents, , ȱ۲, ¥״뵵 , , latex ״ ¥(\,?, %), hypertarget ִ ̴.
- λ縻 abstract, tableofcontents tableofcontents section subsection, ۲ emph ¥״ boxedverbatim latex ȱ¥ hypertarget \url ٲٸ ɰ .
- Emacs Ϸδ ׳ emacs ϴ Ͱ ؼ LISP program غ Ѵ.
- LISP program ٴ Լ ؼ ǹǷ Lisp Interaction mode ۾ϱѴ. < Ͽ M-x lisp-interaction mode ָ带 ϰ Ŀ Ʒ code ְ C-j Էϸ ˴ϴ. Ϸ ϴ text ȭϿ M-x Լ ϸ ˴ϴ.>
(defun mod-wiki () (interactive) (save-excursion ( replace-regexp "===\\(.*?\\)===" "\\\\subsection(\\1)") ( replace-regexp "==\\(.*?\\)==" "\\\\section{\\1}")))
- LISP program ٴ Լ ؼ ǹǷ Lisp Interaction mode ۾ϱѴ. < Ͽ M-x lisp-interaction mode ָ带 ϰ Ŀ Ʒ code ְ C-j Էϸ ˴ϴ. Ϸ ϴ text ȭϿ M-x Լ ϸ ˴ϴ.>
- wiki * \item ٲٰ Ŀ ó \item \begin{itemize} ̴ codeԴϴ. ſ űմϴ. ̷ textȭϿ κп Ư κ ִٴ ̿!! ֽϴ. ֳ. conditional ٿϴ. ̻ 쿡 if ϳ ϰ!.
(defun mod-listofwiki () (interactive) (save-excursion (goto-char (point-min)) (while (< (point) (point-max)) (let ((count (re-search-forward "^\\\\item"))) (backward-word) (backward-char) (goto-char (point)) (insert "\\begin{itemize}\n") (forward-line 1) (goto-char(point)) (while (looking-at "^\\\\item") ( if (looking-at "^\\\\item2") (progn (insert "\\begin{itemize}\n") (forward-line 1) (while (looking-at "^\\\\item2") (forward-line 1)) (insert "\\end{itemize)\n")) (forward-line 1))) (insert "\\end{itemize}\n")))))
- wiki \command \begin{env} ؾ ϳ Դϴ. ׳ ϱδ \command \begin{env} \verb ġȯϿ ȿ ɰ , װ ܼ ʽϴ. ֳϸ 츮 text boxedverbatimȯ ٲ۴ٰ ߰, ٸ ȿ ִ ͵ ٲ ϴ. ȵDZ narrow-to-region̶ ELISP ԼԴϴ. ̰͵ ι ؾ ε ɴϴ. ϱ? ߰߰ \ ۵Ǵ ̷ ٲٴ ֽϴٸ, ̰ ũ Ƽ ׳ ξϴ.
(defun mod-wikitotex () (interactive) (save-excursion ( replace-regexp "{{{" "\\\\begin{boxedverbatim}" ) ( replace-regexp " ݴȣ" "\\\\end{boxedverbatim}" ) ( point-min ) ( while (< (point) (point-max)) ( narrow-to-region (point) (progn (search-forward "\\begin{boxedverbatim}") (backward-word) (backward-word) (backward-char) (point))) ( goto-char (point-min)) ( replace-regexp "\\(\\\\[a-zA-Z{}]*\\)" "\\\\verb{\\1}") ( widen ) ( search-forward "\\end{boxedverbatim}") ( narrow-to-region (point)( progn (search-forward "\\begin{boxedverbatim}") (backward-word) (backward-word) (backward-char) (point))) ( goto-char (point-min)) ( replace-regexp "\\(\\\\[a-zA-Z{}]*\\)" "\\\\verb{\\1}") ( widen ))))
- Լ ̿ϸ ɰ ϴ. Ȥ ʿϽź ѹ غڽϴ.
6.3.1 Q1 ¶
LISP program ִµ, ִ. ù° Emacs ״ 찡 ִٴ ̴.( ̷ ٽ linux ư ʹ) ι° file cursor ó ־ Ѵٴ ̴.(?) ڴ° 齺 ̴. ü 齽ø ˼ . ֽǺ Ű?
6.3.2 A1 ¶
쿡 ״? file cursor ó ־ Ѵٴ ǹ̰ ? lisp regular expression 齽 2 ʿϴٰ ø ˴ϴ.(״ ̸ƽ ϱ "Ѻ̵" p412뿡 ø ڼ ֽϴ.
(replace-regexp "fred\\*" "bob*")
LISP ʹ fred\\* fred\* ؼؼ replace-regexp ڷ ѱ. replace-regexp fred\* fred ڿ ǥ ǥõ · νѴ. replace-regexp ι° ڴ ǥ ƴϹǷ bob* ø ̿ ̽ ڵ尡 ʿ. Էؼ Ѵٸ ø ʴ´. ESC x replace-regexp RETURN Էϰ, fred\* bob* ԷѴ. ̴Ϲۿ Ƶ ڿ ٸ ؼѴ.
|
--hermian
6.3.3 Q2 ¶
մϴ. å 鼭 ϰ ֽϴ.(?) ̷ нɷ ! .... ù° Emacs ״ 츦 ϰ Ŀ wikitestȭ ϰ ʰ, closeҶ ϴ. gnuserver error ϸ鼭 stnin Է ٰ մϴ. ̷ error message Դٰ Դٰ մϴ. ι° function ϸ ε ѹ ʽϴ. ι ̻ ؾ ɴϴ.( ϱ ׳! ʳ! ؼ Դϴ) ̷ ݹ ϰ... ° "̴Ϲۿ ڿ ٸ ؼѴ" ü ˼ ϴ. * escapse sequence Ƶ̷ϸ տ \\ ־ Ѵٴ ذ ϴ. \\\ ʳ ߽ϴ. ̷ ϰ ߴ Invalid \ use ϴ error message ! ᱹ \\\\ ϳ ߴ, Խϴ. ϳ ؾ ϳ?
ps) ϸ tex file Ⱑ ʳ? * item ĭ * item2 ȯ ѷ־ ϴµ.... ۰ Ⱑ ʽϴ. ʾƼ ׳ ֽϴ. õ մϴٸ. --synapse
6.3.4 A2 ¶
ι° function parameter ϴ. bufferü µ ɶ ؾ ϴ . Ƹ replace-regexpԼ Ư ڰ Ŀġ ˴ϴ. M-x describe-function RETURN replace-regexp RETURN Ͻø ð̴ϴ.
̴Ϲ۶ ̸ƽ Ʒ ⿵ ǹѴٴ ƽð. Լ ϵ M-x replace-regexp RETURN ̶ ġ Replace regexp: ɴϴ. ã ڸ Էϰ RETURN Էϸ Replace regexp begin with: ٲ ڸ Էϰ ˴ϴ. ̶ ̷ 亯(?)Ҷ Ϲ ø ϳ ٴ Դϴ. ô 䵥 ʴ±. interactiveԼ Լ callҶ ø ΰ, ̸ƽ ɾ Ҷ ø Ѱ ̷ ص ɰ ϴٸ.
½ϴ. Emacs lisp-interaction mode ؼ ҽϴ. wiki page copyؼ emacs ٿְ ο â ϳ ϴ. M-x lisp-interaction-mode Ͻð. ڵ带 Ƽ copyϰ ȭ C-jϽø wiki-mod Լ ǵ˴ϴ. ٽ wiki page copy ͼ M-x wiki-modϸ ٲ ɴϴ. ٲٴ ִµ, Ұ͵ , űϱ մϴ.մϴ.--synapse