コンテンツにスキップ

M1 MacとVSCodeでLaTeX環境を構築

以下の記事を参考にインストールする.

M1 Mac

ダウンロード

curl -L -o install-tl-unx.tar.gz https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz

展開

tar xvzf install-tl-unx.tar.gz

インストール

sudo mkdir /usr/local/texlive
sudo ./install-tl-20221221/install-tl --no-gui --repository http://ftp.jaist.ac.jp/pub/CTAN/systems/texlive/tlnet/

インストール実行

======================> TeX Live installation procedure <=====================

======>   Letters/digits in <angle brackets> indicate   <=======
======>   menu items for actions or customizations      <=======
= help>   https://tug.org/texlive/doc/install-tl.html   <=======

 Detected platform: MacOSX current (10.14-) on ARM/x86_64

 <B> set binary platforms: 1 out of 16

 <S> set installation scheme: scheme-custom

 <C> set installation collections:
     40 collections out of 41, disk space required: 7143 MB

 <D> set directories:
   TEXDIR (the main TeX directory):
     /usr/local/texlive/2021
   TEXMFLOCAL (directory for site-wide local files):
     /usr/local/texlive/texmf-local
   TEXMFSYSVAR (directory for variable and automatically generated data):
     /usr/local/texlive/2021/texmf-var
   TEXMFSYSCONFIG (directory for local config):
     /usr/local/texlive/2021/texmf-config
   TEXMFVAR (personal directory for variable and automatically generated data):
     ~/Library/texlive/2021/texmf-var
   TEXMFCONFIG (personal directory for local config):
     ~/Library/texlive/2021/texmf-config
   TEXMFHOME (directory for user-specific files):
     ~/Library/texmf

 <O> options:
   [ ] use letter size instead of A4 by default
   [X] allow execution of restricted list of programs via \write18
   [X] create all format files
   [X] install macro/font doc tree
   [X] install macro/font source tree
   [ ] create symlinks to standard directories

 <V> set up for portable installation

Actions:
 <I> start installation to hard disk
 <P> save installation profile to 'texlive.profile' and exit
 <Q> quit

Enter command:  I

しばらくまつ.

パスを通す(以下を .zshrcや.bashrcにかく)

export PATH="${PATH}:/usr/local/texlive/2022/bin/universal-darwin"

VSCodeの設定

以下の記事を参考にVSCodeの設定を行う.

VSCode で最高の LaTeX 環境を作る - Qiita

.latexmkをホームディレクトリの直下につくる.

touch ~/.latexmkrc

記事と同一の .latexmkrcをつくる.

Visual Studio CodeにLaTeX Workshopをインストールする.

プロジェクトの直下に .vscode/settings.json をつくる.

内容は記事の内容と同一にする.

ビルド

VSCodeでビルドしたいtexファイルを開いた状態で,LaTeX拡張を開きRecipe: latexmkを選ぶ.すると,out/の直下にPDFファイルが作成される.

Screen Shot 2022-08-14 at 23.21.32.png (453.2 kB)