0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

EmacsでLaTeXを使えるようにする

0
Last updated at Posted at 2026-08-07

はじめに

(情報科なのに)数学のレポートを提出する必要があったことと、普通にLaTeXを使えるようになりたい気持ちがあったことでLuaLaTeXの導入に至りました。
わたしはEmacs信者なのでWSL2+Ubuntu+Emacsで実行しています。
WSL2とUbuntu、Emacsの導入については下記リンクから。
※Emacsのセットアップについては大学でもらったものを多分に利用しているのでここでは公開していません

インストールする1

LuaLaTeXと関連するパッケージ、PDFビューワを入れます。
もちろん先にsudo apt update``sudo apt upgradeは実行しておいてください。
時間がかかるので回線の安定と時間を確保してから行います。

$ sudo apt install -y texlive-lang-japanese  texlive-latex-extra texlive-luatex evince

インストールを確認する

$ lualatex --version

自分の環境だとこんな感じでした

This is LuaTeX, Version 1.22.0 (TeX Live 2025/Debian)
Development id: 7673

Execute  'luatex --credits'  for credits and version details.

There is NO warranty. Redistribution of this software is covered by
the terms of the GNU General Public License, version 2 or (at your option)
any later version. For more information about these matters, see the file
named COPYING and the LuaTeX source.

LuaTeX is Copyright 2025 Taco Hoekwater and the LuaTeX Team.
$ platex --version

自分の環境だと(以下略)

e-upTeX 3.141592653-p4.1.2-u2.00-250202-2.6 (utf8.euc) (TeX Live 2025/Debian)
kpathsea version 6.4.1
ptexenc version 1.5.1
Copyright 2025 D.E. Knuth.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the e-upTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the e-upTeX source.
Primary author of e-upTeX: Japanese TeX Development Community.
$ which evince

これは返ってきたのは一行だけでした

Evince 49.alpha

使ってみる

埼大が公開しているテンプレートを使って試してみます。
1.まずは作業用のディレクトリを作成し、移動

$ mkdir -p ~/Sandbox
$ cd ~/Sandbox

2.GitHubから落とし込む(※実行にはgitコマンドが必要)

$ git clone https://github.com/yuichigoto/tex-template-ics.git

3.ディレクトリを移動し、サンプルファイルをコンパイル

$ cd tex-template-ics/Jpn/BMthesis
$ lualatex sample.lualatex.tex 

4.ファイルをビューワで確認する

$ evince sample.lualatex.pdf &

実はEmacsでファイルを開くこともできます(最高)。
私はevinceの「GUI版Linux」的なもっさりしたUIが好きじゃないので結局使ってません(笑)

Emacsの設定を行う

1.追加パッケージを入れる

$ sudo apt -y install yatex

2.init.elに設定を書き込む

$ cd ~/.emacs.d/init.el

以下の設定を分かりやすいところに追加してください。
(leafパッケージが前提となっている点には注意)

init.el
;; YaTeX
(leaf yatex
  :commands yatex-mode
  :mode (("\\.tex$" . yatex-mode))
  :init
  (setq tex-command "lualatex")
  (setq dvi2-command "evince")
  :config
  )

3.TeXファイルをEmacsで開いてみる

$ cd ~/tex-template-ics/Jpn/BMthesis
$ emacs sample.lualatex.tex 

ミニバッファにWelcome to the field of YaTeX. I'm glad to see you!とメッセージが表示されていれば成功

  1. インストール~確認までは埼玉大学のHPをかなり参考にしています、というか、ほぼそのままです ↩

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?