見出し画像

数理科学風のLaTeX作成術

こんにちは、ぶじょんぬいです。今回は数学系あるいは物理系でおなじみの数理科学"風"のTeXの作り方を伝えます。この構築だけで(日本語のサイトじゃ全然分からないのでgithub等海外ユーザーのサイトと睨めっこしつつ)10時間ぐらいかかったので、だれか使ってください(´;ω;`)

ソースコード

まずはコピペしてみてください。

\documentclass[twocolumn]{ltjsarticle}%二段組の為にtwocolumnに指定
\usepackage{type1cm} %文字サイズ変更
\usepackage[top=20truemm,bottom=20truemm,left=20truemm,right=20truemm]{geometry}%余白の調整
\usepackage{framed}%\begin{framed}をつかうため。
\usepackage{graphics}%画像挿入の為に入れてます。
\usepackage{amsmath,amssymb} %数式特殊記号
\usepackage{fancyhdr}%フッターの設定のため
\usepackage{datetime}%\themonthのためだけにいれた

\renewcommand{\thefootnote}{*\arabic{footnote})}%脚注のフォーマットの変更

\renewcommand{\theequation}{\thesection.\arabic{equation}}%theequation式番号の変更
\makeatletter%定義の中に@があるとき必要な環境
\@addtoreset{equation}{thesubsection}%thesubsectionが増加したときequationをリセット
\makeatother



\renewcommand{\section}[2][]{%sectionコマンドの再定義
  \refstepcounter{section}#1 %カウントを1増加,
  \par
  \begin{framed}
  \centering\textbf{\arabic{section}. #2}
  \end{framed}
  \par
}

\newdateformat{monthyeardate}{%
  \monthname[\THEMONTH], \THEYEAR}

%pagestyleの設定%
\fancypagestyle{fancy}{%
\lhead{}%ヘッダ左を空に
\rhead{}%ヘッダ右を空に
\cfoot{}%ヘッダ中央下を空にする
\rfoot{某雑誌名 No.??,\ \monthyeardate\today \hfill\thepage}%この辺をいじくると名前が変えられます。
\renewcommand{\headrulewidth}{0.0pt}%ヘッダの線を消す
}

\newcommand{\booktitle}[1]{\textit{#1}}
  \def\mdash{\textemdash}
  \def\amslatex{{\protect\AmS-\protect\LaTeX}}

\makeatletter
\renewcommand{\@biblabel}[1]{#1)}%参考文献の書き方の変更
\renewcommand{\@cite}[2]{{#1\if@tempswa , #2\fi})}%参考文献の呼び出し方の変更
\renewenvironment{thebibliography}[1]
     {{\begin{center} \large\textbf{参考文献} \end{center}}
      \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}
\makeatother




\renewcommand{\maketitle}{
  %maketitleの再定義、数理科学風に書き換えます。この辺をいじくればタイトル名だったり著者名を変えることができます。
  \twocolumn[
  特集/ \LaTeX 入門\\%黒線の上の文章を\\前に書いてください
  \footnotesize{■\!\!■\!\!■\!\!■\!\!■\!\!■\!\!■\!\!■\!\!■\!\!■\!\!■\!\!■\!\!■\!\!■\!\!■\!\!■\!\!■
  \!\!■\!\!■\!\!■\!\!■\!\!■\!\!■\!\!■\!\!■\!\!■}\\\\
  \makeatletter
  {\LARGE 数理科学風の\LaTeX をつくる}\\
  \vspace{2.5cm}\\
  {\Large ぶじょんぬい (X:@\_budyonny)}
  \makeatletter\vspace{1cm}
  ]
}

%以下は私がよくつかうのでプリアンブルに定義したコマンド
\newcommand{\bra}[1]{\left\langle#1\right|} %ブラ
\newcommand{\ket}[1]{|#1\rangle} %ブラ
\newcommand{\dbra}[1]{\left\langle#1\right|} %ブラ displaystyle
\newcommand{\R}{\mathbb{R}}%実数
\newcommand{\C}{\mathbb{C}}%虚数
\newcommand{\E}[1]{\begin{equation} #1 \end{equation}}%\E{等式} と簡略化できる
\newcommand{\gazou}[2]{\begin{figure}[H] \centering \includegraphics[scale=#2]{#1} \end{figure}}
%↑画像挿入のコマンドはクソ長いので簡略化しました、
%\gazou{名前.png}{倍率}のようにすれば画像挿入できます。大きさを変える時は倍率の数字をいじくってください。


\begin{document}
\pagestyle{fancy}
\maketitle
\section{つくってみた}
みたらわかると思いますが、数理科学風の\LaTeX 版を作ってみました。
使い方は今までと同様です。
\section{どんなやつなの?}
たとえば→
\footnote{いつもどうり下に脚注が表示されるよ!}
のように脚注を入れたり、
\begin{equation}
  LHS=RHS
\end{equation}
のようにequation環境の等式もかけます。あとフッターに現在のページ数と雑誌名っぽいなにかを表示させることもできます。
また\cite{あ}のように参考文献を挿入することもできます。

\begin{thebibliography}{99}
  \bibitem{あ} 
  参考文献1
  \bibitem{い} 
  参考文献2 
\end{thebibliography}

\end{document}

すると以下のようなPDFが作れます

今のところは

  • /titleの変更(タイトル欄のテンプレを変えた)

  • セクションを□でくくる

  • セクション番号を(小番号.○○)とする

  • 参考文献(thebibliographyを使用)のデザインの変更

  • フッターのデザインの変更(左に雑誌名+日付、右にページ)

  • よく使うコマンドをdefした

ってのが主な内容になります。

この記事が気に入ったらサポートをしてみませんか?