Skip to content

Instantly share code, notes, and snippets.

@eggplants
Last active April 18, 2022 02:28
Show Gist options
  • Save eggplants/f0484290a13cb928955c7728f228cadd to your computer and use it in GitHub Desktop.
Save eggplants/f0484290a13cb928955c7728f228cadd to your computer and use it in GitHub Desktop.
texこれだけ in Ubuntu
#!/bin/bash
# compile:
# $ latexmk *.tex
# compile && preview:
# $ latexmk -pv *.tex
# ref:
# https://qiita.com/rainbartown/items/d7718f12d71e688f3573
if ! command -v curl &> /dev/null; then
echo "install: curl" >&2
exit 1
fi
if ! command -v code &> /dev/null; then
curl -L "https://go.microsoft.com/fwlink/?LinkID=760868" -o vscode.deb
sudo apt install -y ./vscode.deb
fi
sudo apt install texlive-full -y
if ! [ -f ~/.latexmkrc ]; then
cat << 'A' > ~/.latexmkrc
#!/usr/bin/env perl
# LaTeX
$latex = 'platex -synctex=1 -halt-on-error -file-line-error %O %S';
$max_repeat = 5;
# BibTeX
$bibtex = 'pbibtex %O %S';
$biber = 'biber --bblencoding=utf8 -u -U --output_safechars %O %S';
# index
$makeindex = 'mendex %O -o %D %S';
# DVI / PDF
$dvipdf = 'dvipdfmx %O -o %D %S';
$pdf_mode = 3;
# preview
$pvc_view_file_via_temporary = 0;
if ($^O eq 'linux') {
$dvi_previewer = "xdg-open %S";
$pdf_previewer = "xdg-open %S";
} elsif ($^O eq 'darwin') {
$dvi_previewer = "open %S";
$pdf_previewer = "open %S";
} else {
$dvi_previewer = "start %S";
$pdf_previewer = "start %S";
}
# clean up
$clean_full_ext = "%R.synctex.gz"
A
fi
if ! code --list-extensions | grep -q Jeff-Tian.tex-workshop; then
code --install-extension Jeff-Tian.latex-workshop
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment