macOS Sequoia 上で日本語レポート作成環境を整える

はじめに_

homebrewおよびemacsがインストール済みとする。

LaTeX_

mactexのインストール_

TeXWiki: homebrewを用いたインストールに従い、インストールする。結構時間がかかるので注意(私の環境では30分〜1時間以上かかった)。

% brew install --cask mactex
% eval "$(/usr/libexec/path_helper)"
% sudo tlmgr update --self --all
% sudo tlmgr paper a4

% brew install evince

2025年6月3日現在のバージョンは以下の通り。

% lualatex --version
This is LuaHBTeX, Version 1.21.0 (TeX Live 2025)
Development id: 7667

Execute  'luahbtex --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)
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.

参考

確認_

埼玉大学工学部情報システム工学科LaTeX用学位論文テンプレート(非公式)からファイルをダウンロードし、コンパイルおよびPDFファイルを作成できるかを確かめる。

% cd ~/Sandbox
% git clone https://github.com/yuichigoto/tex-template-ics.git
% cd tex-template-ics/Jpn/BMthesis

% platex sample.utf8.tex
% platex sample.utf8.tex
% dvipdfmx sample.utf8
% evince sample.utf8.pdf &

% lualatex sample.lualatex.tex
% evince sample.lualatex.pdf &

ヒラギノフォントを使う_

参考URL

上記の回答によれば、LuaLaTeXを使う場合は ¥usepackage[hiragino-pron]fluatexja-preset}を使えば良いとのこと。

yatexのインストール_

LaTeX形式のファイル作成支援環境 yatex のインストールする。インストールにはemacsのバッケージシステムを用いる。

emacs上でM-x package-list-packages を実行する。M-x (Escキーを押しながらxキーを押す)を押し、ミニバッファに「package-list-packages」を入力する。なお、Tabキーによる補完機能があるので適宜利用すると便利(「pac」まで入力し、Tabキーを押すと「package」と補完してくれる)パッケージリストが以下のように表示される。

このリストの中からyatexパッケージを探す。emacs上でC-s (Controlキーを押しながらsキーを押す)を押すとミニバッファが入力待ちなるのでyatexと入力する。するとyatexという文字までカーソルが飛ぶ。Enterキーを押して検索モード終了。

「yatex」という文字にカーソルを合わせてEnterキーを押す。するとemacsが二画面表示になり、下の表示欄に「Install」というボタンが表示される。マウスでカーソルをあわせ、Installボタンを押す。その後、一度、emacsを終了する。

~/.emacs.d/init.elにyatexの設定を加える。emacsで~/.emacs.d/init.elを開く。

% emacs &

init.elの「(provide 'init)」の上に以下の内容を追記し、保存する。

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

emacsを終了し、設定を反映させる。

% cd ~/.emacs.d
% emacs --batch -f batch-byte-compile init.el

先ほどの tex-template-ics/Jpn/BMthesis/sample.utf8.tex をemacsで開き、YaTeXモードになっているかを調べる。なお、emacsがすでに起動している場合は起動しなおすこと。

YaTeXモードが読み込まれていると以下のようにemacsのミニバッファにメッセージが表示される。

R_

さまざまなインストール方法があるが、今回はUbuntu利用者と環境を合わせるため、homebrewを用いてインストールする。結構時間がかかるので注意。

インストールする。

% brew install r

起動してみる。終了はメッセージのとおりq()を入力する。その後の選択はnを入力する。

% R

R version 4.5.0 (2025-04-11) -- "How About a Twenty-Six"
Copyright (C) 2025 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin24.4.0

R は、自由なソフトウェアであり、「完全に無保証」です。 
一定の条件に従えば、自由にこれを再配布することができます。 
配布条件の詳細に関しては、'license()' あるいは 'licence()' と入力してください。 

R は多くの貢献者による共同プロジェクトです。 
詳しくは 'contributors()' と入力してください。 
また、R や R のパッケージを出版物で引用する際の形式については 
'citation()' と入力してください。 

'demo()' と入力すればデモをみることができます。 
'help()' とすればオンラインヘルプが出ます。 
'help.start()' で HTML ブラウザによるヘルプがみられます。 
'q()' と入力すれば R を終了します。

> 

> q()
Save workspace image? [y/n/c]: n

Inkscape_

% brew install --cask Inkscape

起動する。

% inkscape &

gimp_

% brew install --cask gimp

起動する。

% gimp &

戻る_