Skip to content

Instantly share code, notes, and snippets.

@cffnpwr
Last active October 16, 2022 15:16
Show Gist options
  • Save cffnpwr/baa5db13e8bdeb1a6cc245f45f9dd367 to your computer and use it in GitHub Desktop.
Save cffnpwr/baa5db13e8bdeb1a6cc245f45f9dd367 to your computer and use it in GitHub Desktop.

eireport style feat. LuaLaTeX

これはなに

私がレポートを書くときに使ってるスタイルファイルのLuaLaTeX版です。

通常版との違いはなに

  • LuaLaTeXに対応したのでjlistingsを入れなくてよい
  • .texから直接.pdfを生成できる

使用方法

  1. TeX環境にlatex-binluatexjaをインストール
  2. eireport.sty.latexmkrcをダウンロード
  3. .texファイルと同じディレクトリに配置する
  4. latexmk [ファイル名]を実行してpdfファイルを生成する
#!/usr/bin/env perl
## latex commands
$latex = 'lualatex --cmdx -file-line-error -synctex=1 -interaction=nonstopmode -halt-on-error';
$max_repeat = 5;
## pdf mode
$pdf_mode = 4; # use LuaLaTeX
\usepackage[top=30mm, bottom=30mm, right=25mm, left=25mm]{geometry}
\usepackage{siunitx}
\usepackage{graphicx}
\usepackage{array}
\usepackage{multirow}
\usepackage{listings}
\pagestyle{empty}
\DeclareOption{enPageNum}{\pagestyle{plain}}
\ProcessOptions\relax
\makeatletter
\renewcommand{\theequation}{\thesection.\arabic{equation}}
\renewcommand{\thefigure}{\thesection.\arabic{figure}}
\renewcommand{\thetable}{\thesection.\arabic{table}}
\@addtoreset{equation}{section}
\@addtoreset{figure}{section}
\@addtoreset{table}{section}
\long\def\@makecaption#1#2{%
\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}
\def\@biblabel#1{#1.}
\makeatother
\newcolumntype{I}{!{\vrule width 1.5pt}}
\newcommand{\bhline}{\noalign{\hrule height 1pt}}
\newcommand{\ctext}[1]{\raise0.2ex\hbox{\textcircled{\scriptsize{#1}}}}
\renewcommand{\baselinestretch}{1.2}
\renewcommand{\labelenumi}{(\arabic{enumi})}
\setlength{\unitlength}{1mm}
\newcommand{\reffig}[1]{図\ref{#1}}
\newcommand{\reftab}[1]{表\ref{#1}}
\newcommand{\refeq}[1]{式(\ref{#1})}
\lstset{
basicstyle=\ttfamily\scriptsize,
breaklines=true,
frame=trbl,
tabsize=4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment