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?

DockerコンテナでLaTeX文書作成

Posted at

以前から$\LaTeX$を使って綺麗な数式を表示することに憧れていましたが,環境構築が厄介そうという理由で数年間放置していました.ふとしたきっかけで,何やらDockerでも$\LaTeX$の文書を作成できるらしいと聞いたので,試したことを記載します.

実行環境

  • Windows11 + WSL2 + Docker Desktop
  • RAM 8GB
  • 1TB SSD

コンテナの立ち上げ

イメージは,texlive/texlive:latestを使用しました.2GB越えのため,プルの時間は辛抱強く待ちます.

compose.yml
services:
  latex:
    image: texlive/texlive:latest
    container_name: latex
    volumes:
      - ./src:/workdir
    tty: true

早速立ち上げます.

docker compose up -d

コンテナ内に入り,動作確認します.

docker compose exec -it latex bash
platex -v
# 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
# ...
dvipdfmx --version
# This is dvipdfmx Version 20250410 by the DVIPDFMx project team,
# modified for TeX Live,
# an extended version of dvipdfm-0.13.2c developed by Mark A. Wicks.
# ...

正常に動いている様子です.試しに,サンプルファイルを./srcに配置してpdfファイルに変換してみます.

sample.tex
\documentclass{article}
\begin{document}
Hello, \TeX!
\[ \int dx = x + C. \]
\end{document}
platex sample.tex
dvipdfmx sample

スクリーンショット 2025-10-27 111516.png

無事にpdfを作成できました.

sample2.tex
\documentclass{jsarticle}
\begin{document}
こんにちは,\TeX!
\[ \int dx = x + 定数. \]
\end{document}

スクリーンショット 2025-10-27 111836.png

日本語を含む文書も問題なく作成できました.

まだ,書き方などは全然わかっていないため,これから勉強していきます.

お読みいただきありがとうございました.

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?