有料ではありますが,TeXPadはMac利用者にとってはとても便利なソフトウェアだと思います.
日本語を利用する際には,デフォルトではplatex->dvipdfmxであればコンパイルすることが可能です.一方で,uplatexなどを用いてコンパイルしたい場合には,独自のBuild Scriptを作成する必要があります.uplatexとupbibtexを用いてコンパイルするBuild Scriptを作っても良いのですが,latexmkを用いてコンパイルできるようにすれば,カスタマイズが容易になり非常に便利です.
元々TeXPadにはlatexmk用のBuild Scriptがありますが,日本語対応ではありません.そこでlatexmk用のBuild Scriptを作成しました.コンパイルする際にbackupファイルを作成することとと,コンパイルの際に大量に出てくる中間ファイルを.texpadtmpフォルダに移動する仕組みを実装しています.中間ファイルを移動する仕組みは,一度すべてのファイルを.texpadtmpフォルダに移動した後にtexファイルだけ戻してくる方法をとっています.
#!/bin/bash
# texのbackup(.bk)を作成
cp "$TEXPAD_ROOTFILE" "$TEXPAD_ROOTFILE_NO_EXT".bk
# texのコンパイル
latexmk -gg -pdfdvi "$TEXPAD_ROOTFILE"
# 中間ファイルを.texpadtmpに作成
mkdir .texpadtmp 2>/dev/null
mv -f "$TEXPAD_ROOTFILE_NO_EXT".* .texpadtmp/ 2>/dev/null
fname=$(basename "$TEXPAD_ROOTFILE_NO_EXT") 2>/dev/null
mv -f ./.texpadtmp/"$fname".{tex,bib} ./ 2>/dev/null
uplatex, upbibitexもしくはbiberを用いる設定ファイルとして,以下のものを用いています.PDFはSkim.appを利用してプレビューするように設定していますが,TeXPadではTeXPadのviewerを使いたいので,その点はlatexmkを実行する際に生成されたPDFを表示しない用にして対応しています.
#!/usr/bin/env perl
$latex = 'uplatex %O -synctex=1 -halt-on-error %S';
$latex_silent = 'uplatex %O -synctex=1 -halt-on-error -interaction=batchmode %S';
$biber = 'biber %O --bblencoding=utf8 -u -U --output_safechars %B';
$bibtex = 'upbibtex %O %B';
$makeindex = 'upmendex %O -o %D %S';
$dvipdf = 'dvipdfmx %O -o %D %S';
$pdf_mode = 3;
$pvc_view_file_via_temporary = 0;
$pdf_previewer = 'open -ga /Applications/Skim.app';
MacにTeXをインストールするのは,MacTeXが楽ちんです.必要となるものが一式入っています.インストール方法は大きく2つあります.ただし,ファイルサイズが非常に大きいので時間がかります.時間に余裕のあるときにインストールしましょう.
僕はHomeBrewで色々と管理しているので,HomeBrewを利用してインストールしています.インストール方法は以下のコマンドを入力するだけでOKです.
brew cask install mactex
sudo /usr/local/texlive/yyyy/bin/x86_64-darwin/tlmgr path add # yyyyはインストールしたMacTeXのバージョン(西暦)
sudo tlmgr update --self --all
sudo tlmgr paper a4
※ texliveが2つ以上入っているとTLPOBJ.pmのpermission errorなどのエラーが出てしまうことがあるようです.その場合は(本質的な解決ではありませんが,full pathでtlmrgを実行するとうまくいくかもしれません
sudo /usr/local/texlive/yyyy/bin/x86_64-darwin/tlmgr update --self --all
sudo /usr/local/texlive/yyyy/bin/x86_64-darwin/tlmgr paper a4
--- 以下は過去の遺産:2020より原ノ味フォントがデフォルトで埋め込まれる設定になっているようです.---
Macですのでヒラギノフォントを使いたくなるものです.munepiさんという方がgithub上にヒラギノフォントパッチを公開してくださっています.こちらをありがたく使わせて頂くのが楽ちんです.munepiさんgithubからbibunsho7-patch.appをダウンロードして,通常のアプリと同様にインストールすればOKです.
主にメモを作成する際に用いているもの
phfnoteパッケージと,titlesecパッケージを用いて,titleやsection titleのフォーマットをカスタマイズしている
\documentclass[11pt]{scrartcl}
\frenchspacing % 文章の間をdouble spaceにしない
\linespread{1.2} % linespaceの設定
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=20mm,
top=20mm,
} % A4サイズ
\usepackage{datetime2} % dateのフォーマットをカスタマイズ
\DTMsetstyle{iso} % iso形式のdateフォーマット
\usepackage{amsmath, amssymb, amsthm}
\usepackage{graphicx}
\usepackage{color}
\usepackage{hyperref}
\usepackage{enumitem}
\usepackage{ascmac}
% 利用フォントの指定,LaTeXエンジンをluatexとして日本語を利用可能に
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{luatexja}
\usepackage[haranogi]{luatexja-preset}
\usepackage[T1,euler-digits]{eulervm}
% Title, Section Titleをカスタマイズ
% \usepackage[title=default]{phfnote}
\usepackage[title=small,par=skip]{phfnote}
\usepackage{titlesec}
\titleformat{\section} %\sectionを変更
[hang] % 形状の指定
{\large\bfseries\sffamily} %フォントサイズとフォントスタイルの指定
{\thesection} %ラベルはsection番号
{4pt} %ラベルと見出しとの間隔
{} %見出し文字列の前には記号などなし
[\titlerule] %見出し下に下線
\titleformat{\subsection} %\subsectionを変更
[hang] % 形状の指定
{\normalsize\bfseries\sffamily} %フォントサイズとフォントスタイルの指定
{\thesubsection} %ラベルはsubsection番号
{4pt} %ラベルと見出しとの間隔
{} %見出し文字列の前には記号などなし
[\vspace{-8pt}] %見出し下のスペースを縮小
\titleformat{\subsubsection} %\subsectionを変更
[hang] % 形状の指定
{\normalsize\bfseries\sffamily} %フォントサイズとフォントスタイルの指定
{} %ラベルは非表示
{4pt} %ラベルと見出しとの間隔
{■} %見出し文字列の前に■
主に論文の原稿を作成する際に用いているもの
謝辞(先人の知恵を拝借した部分)
Overleafに公開されているpreprint用テンプレートであるarxiv.styを利用させて頂いています.
ソースコードは以下ですが,現状整理されていません.
\documentclass[draft,11pt]{article}
% arixv.styの利用
\usepackage{arxiv}
% 必要なパッケージの読み込み
\usepackage{datetime2}
\DTMsetstyle{iso}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[standard-baselineskips]{ccfonts}
\usepackage{eulervm}
\usepackage{hyperref}
\usepackage{url}
\PassOptionsToPackage{spaces, hyphens, allowmove}{url}
%\usepackage{booktabs}
%\usepackage{amsfonts}
%\usepackage{nicefrac}
%\usepackage{microtype}
\usepackage{graphicx}
\usepackage{amsmath, amssymb, amsthm}
\usepackage{enumitem}
% 定理環境の定義
\theoremstyle{theorem}
\newtheorem{theorem}{Theorem}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{cor}[theorem]{Corollary}
\newtheorem{example}[theorem]{Example}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{guide}[theorem]{Guide}
\title{TITLE}
\author{AUTHOR1 \And AUTHOR2 \And AUTHOR3}
\date{\today}
\renewcommand{\headeright}{AHTHOR1 et al.}
\chead{SHORT TITLE}
% bibliographyの設定
\usepackage[backend=biber,style=ieee]{biblatex}
\addbibresource{HOGE.bib}
% draftに用いるshowkeysとshowlabelfontのカスタマイズ
% keyはグレーで表示され,適宜改行もされる.
% labelは青字で表示される.
\usepackage{color}
\usepackage[color]{showkeys}
\renewcommand*{\showkeyslabelformat}[1]{%
\fbox{\vbox{\hsize=1.1cm\normalfont\small\url{#1}\par}}}
\usepackage[inline]{showlabels}
\renewcommand{\showlabelfont}{\small\scshape\color{blue}}
\begin{document}
\maketitle
%%%%%
% 本文を記載
%%%%%
% 参考文献リストの表示
\printbibliography
\end{document}
主にメモを作成する際に用いているもの
謝辞(先人の知恵を拝借した部分)
ソースコードは以下ですが,現状整理されていません.
\documentclass[lualatex,ja=standard,a4paper,jafont=noto]{bxjsarticle}
\makeatletter
\usepackage{fancyhdr}
\fancyhf{}
\pagestyle{fancy}
\newcommand{\headeright}{\DTnow}
\renewcommand{\headrulewidth}{0.4pt}
\fancyheadoffset{0pt}
\rhead{\scshape \footnotesize \headeright}
\chead{\@title}
\cfoot{\thepage}
\newcommand{\@toptitlebar}{
\hrule height 2\p@
\vskip 0.25in
\vskip -\parskip%
}
\newcommand{\@bottomtitlebar}{
\vskip 0.29in
\vskip -\parskip
\hrule height 2\p@
\vskip 0.09in%
}
\renewcommand{\@maketitle}{%
\vbox{%
\hsize\textwidth
\linewidth\hsize
\vskip 0.1in
\@toptitlebar
\centering
{\LARGE\sf \@title\par}
\@bottomtitlebar
\vskip 0.1in
\def\And{%
\end{tabular}\hfil\linebreak[0]\hfil%
\begin{tabular}[t]{c}\bf\rule{\z@}{24\p@}\ignorespaces%
}
\def\AND{%
\end{tabular}\hfil\linebreak[4]\hfil%
\begin{tabular}[t]{c}\bf\rule{\z@}{24\p@}\ignorespaces%
}
\begin{tabular}[t]{c}\bf\rule{\z@}{24\p@}\@author\end{tabular}%
\vskip 0.2in
}
}
\newcommand{\figcaption}[1]{\def\@captype{figure}\caption{#1}}
\newcommand{\tblcaption}[1]{\def\@captype{table}\caption{#1}}
\makeatother
% 必要なパッケージ
\usepackage{datetime2}
\DTMsetstyle{iso}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[standard-baselineskips]{ccfonts}
\usepackage{eulervm}
\usepackage{hyperref}
\usepackage{url}
\PassOptionsToPackage{spaces, hyphens, allowmove}{url}
%\usepackage{booktabs}
%\usepackage{amsfonts}
%\usepackage{nicefrac}
%\usepackage{microtype}
\usepackage{graphicx}
\usepackage{amsmath, amssymb, amsthm}
\usepackage{enumitem}
% 定理環境の設定
\theoremstyle{definition}
\newtheorem{theorem}{定理}
\newtheorem{prop}[theorem]{命題}
\newtheorem{lemma}[theorem]{補題}
\newtheorem{cor}[theorem]{系}
\newtheorem{example}[theorem]{例}
\newtheorem{definition}[theorem]{定義}
\newtheorem{rem}[theorem]{注意}
\newtheorem{guide}[theorem]{参考}
\renewcommand{\proofname}{\textbf{証明}}
% 定理番号,数式番号のカスタマイズ
\numberwithin{theorem}{section}
\numberwithin{equation}{section}
\title{TITLE}
\author{AUTHOR1 \And AUTHOR2 \And AUTHOR3}
\date{\DTnow}
\renewcommand{\headeright}{AHTHOR1 et al.}
\chead{SHORT TITLE}
% bibliographyの設定
\usepackage[backend=biber,style=ieee]{biblatex}
\addbibresource{HOGE.bib}
% draftに用いるshowkeysとshowlabelfontのカスタマイズ
% keyはグレーで表示され,適宜改行もされる.
% labelは青字で表示される.
\usepackage{color}
\usepackage[color]{showkeys}
\renewcommand*{\showkeyslabelformat}[1]{%
\fbox{\vbox{\hsize=1.1cm\normalfont\small\url{#1}\par}}}
\usepackage[inline]{showlabels}
\renewcommand{\showlabelfont}{\small\scshape\color{blue}}
\begin{document}
\maketitle
%%%%%
% 本文を記載
%%%%%
% 参考文献リストの表示
\printbibliography
\end{document}
ZoteroのアドインであるBetter BibTexにおいて,自動フォーマットで付与されるBiBTeXでの引用キーを手動で修正したい.
「Info->Extra」の項目に「Citation Key:利用したい引用キー」と記載する.