岡本順治研究室

学習院大学

cosmos
HOMERESEARCHEDUCATIONLinuxLaTeXet cetraPDGHOME(Deutsch)

inputenc.sty を使ってWebのページをそのままソースに

  1. emacs 21.3.1(VineLinux 3.1)を使うことを前提とします。また、gedit は、 2.4.1。
  2. /etc/X11/xorg.conf のFontPath の順序を以下のように変えて、Xを再起 動させておく。
      # Multiple FontPath entries are allowed (they are concatenated together)
      # By default, Red Hat 6.0 and later now use a font server independent of
      # the X server to render fonts.
    
        FontPath   "/usr/X11R6/lib/X11/fonts/misc"
        FontPath   "/usr/X11R6/lib/X11/fonts/75dpi"
        FontPath   "/usr/X11R6/lib/X11/fonts/japanese"
        FontPath   "/usr/X11R6/lib/X11/fonts/TrueType"
        FontPath   "unix/:7100"
      
    元々の設定は、以下のようになっている。このままだと、バック・スラッシュ が¥に表示され、丸数字も表示できるので、Windows用の文字の入ったファイ ルの編集やメールの受信の際には便利だが、Latin-1 などのフォントセット が優先されて表示できない(emacs21.3.* では、misc のフォント指定をすること で、xorg.conf の設定をいじらなくてもいいようだ。自信なし情報)。
        FontPath   "/usr/X11R6/lib/X11/fonts/TrueType"
        FontPath   "unix/:7100"
        FontPath   "/usr/X11R6/lib/X11/fonts/japanese"
        FontPath   "/usr/X11R6/lib/X11/fonts/misc"
        FontPath   "/usr/X11R6/lib/X11/fonts/75dpi"
       
  3. まずは、どこからかドイツ語のテキストを持ってくる。今回は、Firefox で、 http://www.menschenrecht.com/home.htmlを閲覧し、領域指定して、 gedit を開いておき、そこにペーストし、保存。ここでは、 Menschenrechte.txt とし、保存時の文字コードを iso-8859-1 とした。

    gedit にペーストした時

  4. emacs でMenschenrechte.txt を開く。
    以下のように、きちんとドイツ語の文字が表示されるはず。

    emacs で iso-8859-1 のファイルを開いた
  時

    注意:すでに開いているemacsに、領域指定してペーストすると文字化けする。 これは、gedit からバッファに文字列がコピーされる際に、文字コードが utf-8 になっているという説があるが、さだかではない。もしそうならば、 Mule-UCS をインストールした環境で、あらかじめ言語環境と入出力バッファ も utf-8 にしておけばよさそうだが、emacs 21.3.1 ではうまく動作しない。 emacs 21.4 ではうまくいくらしい(未確認)。

  5. ここまでできたら、後は、ちょこちょこと LaTeX のコマンドを入れるだけ。 例えば、以下のヘッダーを付ける。重要なのは、inputenc のパッケージ。
      \documentclass[12pt]{article}
      \usepackage{ngerman}
      \usepackage[latin1]{inputenc}
      

    latex のソースファイルへと加工
    そして、保存する時に、例えば Menschenrechte.tex のようにして、保存する 際の文字コードを iso-8859-1 のように指定してやる。

  6. ここでは、「やてふ」を使っているが、普段は platex が起動してしまうので、 latex でコンパイルすることを忘れずに。以下は、xdvi でのプレビューの一 部。

    xdvi での preview

    たかだかこれだけのこと。しかし、やってみると簡単で便利。

  7. 先ほどのホームページのテキストファイルは、かなり大きく、 Menschenrechte.txt という名前になっているが、LaTeXの ソースファイル Menschenrechte.tex はほとんど大きさが変わらない。 さらに、dvi ファイルもそんなに大きくないことが分かる。

    [hoge@orara src]$ latex Menschenrechte.tex
    This is TeX, Version 3.14159 (Web2C 7.4.5)
    (./Menschenrechte.tex
    LaTeX2e <2001/06/01>
    Babel  and hyphenation patterns for american, french, german, ngerman, nohyphenation, loaded.
    (/usr/share/texmf/tex/latex/base/article.cls
    Document Class: article 2001/04/21 v1.4e Standard LaTeX document class
    (/usr/share/texmf/tex/latex/base/size12.clo))
    (/usr/share/texmf/tex/generic/german/ngerman.sty v2.5e 1998-07-08)
    (/usr/share/texmf/tex/latex/base/inputenc.sty
    (/usr/share/texmf/tex/latex/base/latin1.def))
    No file Menschenrechte.aux.
    [1] [2] [3] [4] [5] [6] [7] (./Menschenrechte.aux) )
    (see the transcript file for additional information)
    Output written on Menschenrechte.dvi (7 pages, 18500 bytes).
    Transcript written on Menschenrechte.log.
    
    [hoge@orara src]$ ls -l Menschenrechte.*
    -rw-r--r--    1 hoge      hoge             8 May 27 01:36 Menschenrechte.aux
    -rw-r--r--    1 hoge      hoge         18500 May 27 01:36 Menschenrechte.dvi
    -rw-r--r--    1 hoge      hoge          2555 May 27 01:36 Menschenrechte.log
    -rw-r--r--    1 hoge      hoge         15311 May 27 01:35 Menschenrechte.tex
    -rw-r--r--    1 hoge      hoge         13112 May 27 01:05 Menschenrechte.txt
       

  このページの先頭へ戻る

  LaTeXのページのトップへ戻る