てきとーになんか書きます

過去の記事はね,汚点.

Tex環境(2016年12月版)

はじめに

前に自分のTeX環境のまとめをしたのが2015年7月だったので最新版を.
分かりやすく言えばブログの更新がかなり前なので取り敢えずの更新ネタ.

使用しているパッケージ

大体CTANに落ちているものだと思うけど,構築が結構前なものもあるので怪しい.

\documentclass[12pt,a4paper,uplatex]{jsarticle}
\usepackage[dvipdfmx]{graphicx}
\usepackage{array}
\usepackage{ascmac}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{caption}
\usepackage[thmmarks]{ntheorem}
\usepackage{lscape}
\usepackage{enumitem}
\usepackage{cite}
\usepackage{float}
\usepackage{comment}
\usepackage{multicol}
\usepackage{mathrsfs}
\usepackage[left=20truemm,right=20truemm,top=25truemm,bottom=25truemm]{geometry}

まずはこれらを1つ1つ説明していく.

CTAN: Package graphicx

画像ファイルを扱う.

CTAN: Package array

関数の場合分けとかの時に使うやつ.

ascmac

複数行で枠を囲む.

amssymb

数学で使う文字を整える.
例えば

$\textbb{R},\mathfrak{m}$

でそれぞれ白抜きのR,ドイツ文字のmになる.

CTAN: Package amsmath

数学環境を整える.
正直言って何が入っているのかは知らないけど\begin{align*}\end{align*}などはこれがないと使えない.

CTAN: Package caption

図表のキャプションをいじるために.

CTAN: Package ntheorem

定理環境.
要するにDef 1.xとか定理2.x.yとかそういうの.筆者の環境では

\theorembodyfont{\normalfont}
\theoremstyle{break}
\newtheorem{Def}{Def}[section]
\newtheorem{Thm}{Thm}[section]
\newtheorem{Lem}{Lem}[section]
\newtheorem{Prop}{Prop}[section]
\theoremstyle{nonumberplain}
\theoremsymbol{\ensuremath{\blacksquare}}
\newtheorem{Pf}{pf}
\theoremstyle{break}
\newtheorem{Eg}{e.g.}[section]
\theoremstyle{nonumberplain}
\newtheorem{Sign}{目標}
\theoremstyle{break}
\newtheorem{Pb}{問題}[section]
\theoremstyle{nonumberplain}
\newtheorem{Rmk}{Rmk}
\theoremstyle{nonumberplain}
\newtheorem{Mark}{記号}[section]

になっている.
どうも\theoremstyleを複数適用できなさそうで,例えば証明は「番号付け無し」且つ「まず改行」させたいのだけれど,どちらかしかできなさそう.
両方applyするにはどうしたらいいんだろう.
[thmmarks]の記述がなければ,定理環境において記号の使用ができない.
また\theorembodyfont{\normalfont}の指定がなければ以降でアルファベットが勝手にイタリックになるよう.
……そういえばfactが前回に引き続きない.

CTAN: Package lscape

横置きを設定できる.

CTAN: Package enumitem

リストを色々いじれる.
ググれば色々触り方は出てくる.

CTAN: Package cite

参考文献とかで使うやつ.

CTAN: Package float

キャプションの設定とか色々.

CTAN: Package comment

複数行コメントが使える.

\begin{comment}
複数行
複数
\end{comment}

CTAN: Package multicol

2段組とかできる.

CTAN: Package mathrsfs

花文字を使うのに.
以前まではmathptmx.styを使っていて,そうするとmathcalが花文字っぽくなるけど,すべてがTimesになるせいで他の全般が気に食わなかったのでやめた.
これならmathscrが花文字になってくれる.嬉しい.
でもこうすると他はがComputer Modern(であってたっけ……?)だからεが∈みたいになって嫌なのでεだけ変えたいので

\DeclareSymbolFont{my_epsilon}{OML}{cmex}{m}{it}
\DeclareMathSymbol{\myepsilon}{\mathalpha}{my_epsilon}{"22}
\renewcommand{\epsilon}{\myepsilon}

とする.
ztmcmにするとmathptmxで使用されてるフォントになるけど,cmexの場合とztmcmの場合を比較してみると.

f:id:spark6251:20161202012512p:plain

こんな感じに(ε以外はデフォルト).
というわけで文字のバランスを考えてcmexの"22に.
文字の対応とかはLaTeX Fontsあたりを参照すれば良いと思う.

完全に\varepsilonの存在忘れてたよね☆きゃぴ状態なので

\renewcommand{\epsilon}{\varepsilon}

はい.

CTAN: Package geometry

余白の設定.筆者は

\usepackage[left=20truemm,right=20truemm,top=25truemm,bottom=25truemm]{geometry}

である.長さ指定にはtrueが必須である.

ページ先頭のセクションの上の余白をなくす.

\makeatletter
\def\@startsection#1#2#3#4#5#6{%
\if@noskipsec \leavevmode \fi
\par
\@tempskipa #4\relax
\@afterindenttrue
\ifdim \@tempskipa <\z@
\@tempskipa -\@tempskipa \@afterindentfalse
\fi
\if@nobreak
\everypar{}%
\else
\addpenalty\@secpenalty\addvspace\@tempskipa
\fi
\@ifstar
{\@ssect{#3}{#4}{#5}{#6}}%
{\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}

コピーをしたので実際どういう動作をしているのかは知らない.

キャプションをゴシックにする

\makeatletter
\long\def\@makecaption#1#2{\sf
\vskip\abovecaptionskip
\iftdir\sbox\@tempboxa{#1\hskip1zw#2}
\else\sbox\@tempboxa{#1~ #2}
\fi
\ifdim \wd\@tempboxa >\hsize
\iftdir #1\hskip1zw#2\relax\par
\else #1~ #2\relax\par\fi
\else
\global \@minipagefalse
\hbox to\hsize{\hfil\box\@tempboxa\hfil}
\fi
\vskip\belowcaptionskip}
\makeatother

同上.

chapter,sectionのサイズ変更など.

\makeatletter
%\renewcommand{\presectionname}{第}
%\renewcommand{\postsectionname}{章}
\renewcommand{\section}{
\if@slide\clearpage\fi
\@startsection{section}{1}{\z@}
{\Cvs \@plus.5\Cdp \@minus.2\Cdp}
{.5\Cvs \@plus.3\Cdp}
{\normalfont\Large\headfont\raggedright}}
\if@twocolumn
\renewcommand{\subsection}{\@startsection{subsection}{2}{\z@}
{\z@}{\z@}
{\normalfont\normalsize\headfont}}
\else
\renewcommand{\subsection}{\@startsection{subsection}{2}{\z@}
{\Cvs \@plus.5\Cdp \@minus.2\Cdp}
{.5\Cvs \@plus.3\Cdp}
{\normalfont\Large\headfont}}
\makeatother

同上.なんとなく察して.

コマンドの定義

\newcommand{\Ker}{\tr{Ker }}
\newcommand{\Img}{\tr{Img }}
\newcommand{\Tr}{\tr{tr }}
\newcommand{\Dim}{\tr{dim }}
\newcommand{\rank}{\tr{rank }}
\newcommand{\norm}[1]{\Vert#1\Vert}
\newcommand{\Forall}[1]{{\forall}#1\mathrm{\colon\;}}
\newcommand{\Exists}[1]{{\exists}#1\mathrm{\colon\;}}
\newcommand{\UExists}[1]{{\exists}\tr{!}#1\mathrm{\colon\;}}
\newcommand{\Existsst}[2]{{\exists}#1\hspace{0.75em}\mathrm{s.t.}\hspace{0.75em}#2}
\newcommand{\UExistsst}[2]{{\exists}\tr{!}#1\hspace{0.75em}\mathrm{s.t.}\hspace{0.75em}#2}
\newcommand{\openr}[1]{\left[#1\right)}
\newcommand{\openl}[1]{\left(#1\right]}
\newcommand{\open}[1]{\left(#1\right)}
\newcommand{\opencb}[1]{\left\{#1\right\}}
\newcommand{\abs}[1]{\left|#1\right|}
\newcommand{\desceq}[1]{\underset{ #1}{=}}
\newcommand{\Lra}{\Leftrightarrow}
\newcommand{\Ra}{\Rightarrow}
\newcommand{\DEF}{\underset{\textrm{def}}{\Leftrightarrow}}
\newcommand{\IFF}{\underset{\textrm{iff}}{\Leftrightarrow}}
\def\MARU#1{\textcircled{\scriptsize #1}}
\newcommand{\ub}{\underbrace}
\newcommand{\tr}{\textrm}
\newcommand{\mb}{\mathbb}
\newcommand{\rd}{\mb{R}^\tr{d}}
\newcommand{\brd}{\mathcal{B}\open{\mb{R}^\tr{d}}}
\newcommand{\lrd}{\mathcal{L}\open{\mb{R}^\tr{d}}}
\newcommand{\rlm}{\open{\rd,\lrd,\md}}
\newcommand{\ofu}{\open{\Omega,\mathscr{F},\mu}}
\newcommand{\mcf}{\mathcal{F}}
\newcommand{\ale}{\hspace{1em}\tr{a.e.}}
\newcommand{\uae}{\hspace{1em}\mu\tr{-a.e.}}
\newcommand{\for}{\hspace{1em}\tr{for}\hspace{0.5em}}
\newcommand{\with}{\tr{ with }}
\newcommand{\1}{\mbox{1}\hspace{-0.26em}\mbox{l}}
\newcommand{\doub}[1]{\begin{equation*}
    \left\{
    \begin{aligned}
        #1
    \end{aligned}
    \right.
\end{equation*}
}
\newcommand{\doubnon}[1]{
    \left\{
    \begin{aligned}
        #1
    \end{aligned}
    \right.
}

もうちょっと色々追加していきたい.
白抜き文字の数字版をください.indicator functionのために定義しなきゃいけなかった.
あと\aeが合字に使われてたので厳しい.

画像とかのマージン

\setlength\floatsep{0pt}
\setlength\textfloatsep{1pt}
\setlength\intextsep{3pt}
\setlength\abovecaptionskip{3pt}

リストの初期化*1

\renewenvironment{itemize}%  
{%
   \begin{list}{$\rhd$}% 見出し記号/直後の空白を調節
   {%
      \setlength{\topsep}{0em}
      \setlength{\itemindent}{1em}
      \setlength{\leftmargin}{0.5em}%  左のインデント
      \setlength{\rightmargin}{0em}% 右のインデント
      \setlength{\labelsep}{0.5em}%    頭の記号と説明文の間
      \setlength{\labelwidth}{0zw}%  ラベルの幅
      \setlength{\itemsep}{0em}%     項目ごとの改行幅
      \setlength{\parsep}{0em}%      段落での改行幅
      \setlength{\listparindent}{0em}% 段落での一字下り
   }
}{%
   \end{list}%
}

数式環境のマージン

\setlength{\abovedisplayskip}{0pt}
\setlength{\belowdisplayskip}{0pt}

数式環境の余白が大きいので0にした.
但しこれは\begin{document}以降に書く必要がある.

おわりに

意外と増えてた.

2016/12/18 ちょっと改訂.

*1:どのページを参考にしたか失念