LuaTeX

Template collections for LuaTeX

Category

Other

License

Free to use (MIT)

File

Main/LaTeX/LuaTeX_template_rev2.tex

LuaTeX_template_rev2.texRead-only preview
\documentclass[10pt,a4paper]{ltjsarticle}			% for LuaTeX
% \documentclass[10pt,a4paper,uplatex]{jsarticle}	% for upLaTeX

% 見出しのフォントサイズ変更
% http://qiita.com/roaming_south/items/ea39b9554167fcaba882
% \usepackage{titlesec}
% \titleformat*{\section}{\Large\bfseries}
% \titleformat*{\subsection}{\large\bfseries}
% \titleformat*{\section}{\Large}
% \titleformat*{\subsection}{\large}

\usepackage{amsmath}
% \usepackage{ascmac}							% こいつはpLaTeXのpackage
\usepackage{bm}									% for vector
\usepackage{txfonts}							% for \coloneqq \eqqcolon
\usepackage{here}
\usepackage{fancyhdr}
\usepackage{setspace}							% for spacing環境
\usepackage{ulem}								% for \sout{} 取り消し線
\usepackage{url}
% http://osksn2.hep.sci.osaka-u.ac.jp/~naga/miscellaneous/tex/tex-tips3.html
\usepackage{booktabs}							% for \toprule \midrule \bottomrule
% \usepackage{latexsym}
% \usepackage[dvipdfmx]{graphicx}				% upLaTeX
\usepackage[luatex]{graphicx}					% LuaTeX
\usepackage[absolute,overlay]{textpos}			% for textblock absoluteで絶対位置指定
% \usepackage{array}							% 表幅固定
\usepackage{multirow}							% 表で行結合
\usepackage[table]{xcolor}						% for \arrayrulecolor{yellow}\midrule ?
% PDFハイパーリンク,ブックマーク用
% https://texwiki.texjp.org/?hyperref
% http://www.biwako.shiga-u.ac.jp/sensei/kumazawa/tex/hyperref.html
% http://0-chromosome.hatenablog.jp/entry/2015/04/10/175912
% LuaTeX. upLaTeXではオプションが違う.
\usepackage[unicode=true,hidelinks,bookmarksnumbered=true,bookmarksdepth=subsubsection]{hyperref}
% ソースコード用
% \usepackage{listings}
% \lstset{
%	basicstyle=\ttfamily\footnotesize,
%	frame=single,
%	numbers=left,									%行番号を左に書く.消す場合はnone.
%	stepnumber=1,									%行番号を1から始める場合こうする.
%	numbersep=1zw,									%行番号と本文の間隔.
%	breaklines=true,								%1行が長いときの改行.
% }
\usepackage{comment}
% 画像強制位置合わせ
% http://ac206223.ppp.asahi-net.or.jp/adiary/memo/adiary.cgi/hirosugu/TeX%E3%81%A7%E5%9B%B3%E3%82%92%E3%82%B3%E3%83%BC%E3%83%89%E8%A8%98%E8%BF%B0%E4%BD%8D%E7%BD%AE%E3%81%AB%E5%BC%B7%E5%88%B6%E7%9A%84%E3%81%AB%E5%87%BA%E5%8A%9B%E3%81%99%E3%82%8B
\usepackage{here}
% フッタ中央に"今のページ数/総ページ数"を設定
% http://qiita.com/Toru3/items/7ea1342da1e31f0c28c3
\usepackage{lastpage}
\cfoot{\thepage~/~\pageref{LastPage}}
% \layout用
% http://kevlar.blog137.fc2.com/blog-entry-9.html
\usepackage{layout}
% フォント調整
% https://ja.osdn.net/projects/luatex-ja/wiki/LuaTeX-ja%E3%81%AE%E4%BD%BF%E3%81%84%E6%96%B9
% https://tex.stackexchange.com/questions/25249/how-do-i-use-a-particular-font-for-a-small-section-of-text-in-my-document
% \newfontfamily{\ttconsolas}{Consolas}
% \usepackage{fontspec}
% \usepackage[⟨options⟩]{luatexja-fontspec}
\usepackage{luatexja-fontspec}
\newfontfamily\fontConsolas{Consolas}

% コンパイル時に図をとばす
% http://blog.livedoor.jp/tmako123-programming/archives/42210596.html
\newif\iffigure
\figurefalse
\figuretrue


% http://d.hatena.ne.jp/gp98/20090919/1253367749
\makeatletter					% プリアンブルで定義開始

% 表示文字列を"図"から"Figure"へ
\renewcommand{\figurename}{Fig.}
\renewcommand{\tablename}{Table.}

% 図番号を"<節番号>.<図番号>" へ
\renewcommand{\thefigure}{\thesection.\arabic{figure}}
\renewcommand{\thetable}{\thesection.\arabic{table}}
\renewcommand{\theequation}{\thesection.\arabic{equation}}

% 節が進むごとに図番号をリセットする
\@addtoreset{figure}{section}
\@addtoreset{table}{section}
\@addtoreset{equation}{section}

\makeatother % プリアンブルで定義終了


\begin{comment}
\end{comment}


% マクロ
\newcommand{\refSec}[1]   {\ref{#1}章}
\newcommand{\refApd}[1]   {\ref{#1}}
\newcommand{\refSsec}[1]  {\ref{#1}節}
\newcommand{\refSssec}[1] {\ref{#1}項}
\newcommand{\refFig}[1]   {\figurename\ref{#1}}
\newcommand{\refTable}[1] {\tablename\ref{#1}}
\newcommand{\refEq}[1]    {Eq.\ref{#1}}

\newcommand{\myVec}[1] {\bm{#1}}
% https://en.wikibooks.org/wiki/LaTeX/Mathematics#Fractions_and_Binomials
\newcommand*\rfrac[2]{{}^{#1}\!/_{#2}}

\newcommand{\mySubsection}[1] {
	\subsection{#1}
	\vspace{-5pt}
}
\newcommand{\mySubsubsection}[1] {
	\vspace{-2pt}
	\subsubsection{#1}
}
\newcommand{\mathUnit}[1] {\,\mathrm{[#1]}}



\begin{document}
\title{LuaTeX テンプレート}
\author{溶けかけてるうさぎ}
\date{2017年8月2日}
% \date{}											% 日付不要の場合
\maketitle

% pagestyle は maketitleの後
\thispagestyle{fancy}
\pagestyle{fancy}
\lhead{LuaTeX テンプレート}
\rhead{Rev.2.0 : 2017/08/02}
% \rfoot{\includegraphics[width=9mm,keepaspectratio]{./img/logo.pdf}}
% http://qiita.com/tokoro10g/items/06a2a9648bba8bb50da6
\rfoot{
\begin{textblock*}{0.2\linewidth}(503pt, 780pt)		% * で倍率ではなく好きな数字を指定できる.
	\begin{figure}
		\centering
		\includegraphics[clip, keepaspectratio, width=12mm]{./img/logo.pdf}
	\end{figure}
\end{textblock*}
}


\renewcommand{\abstractname}{Abstract}
\begin{abstract}
Wikipedia is a free online encyclopedia with the aim to allow anyone to edit articles. Wikipedia is the largest and most popular general reference work on the Internet and is ranked among the ten most popular websites. Wikipedia is owned by the nonprofit Wikimedia Foundation.
\end{abstract}


% \setcounter{section}{-1}
\section{大見出し}
吾輩わがはいは猫である.名前はまだ無い.

どこで生れたかとんと見当けんとうがつかぬ.何でも薄暗いじめじめした所でニャーニャー泣いていた事だけは記憶している.吾輩はここで始めて人間というものを見た.しかもあとで聞くとそれは書生という人間中で一番獰悪どうあくな種族であったそうだ.この書生というのは時々我々を捕つかまえて煮にて食うという話である.しかしその当時は何という考もなかったから別段恐しいとも思わなかった.ただ彼の掌てのひらに載せられてスーと持ち上げられた時何だかフワフワした感じがあったばかりである.掌の上で少し落ちついて書生の顔を見たのがいわゆる人間というものの見始みはじめであろう.この時妙なものだと思った感じが今でも残っている.第一毛をもって装飾されべきはずの顔がつるつるしてまるで薬缶やかんだ.その後ご猫にもだいぶ逢あったがこんな片輪かたわには一度も出会でくわした事がない.のみならず顔の真中があまりに突起している.そうしてその穴の中から時々ぷうぷうと煙けむりを吹く.どうも咽むせぽくて実に弱った.

\mySubsection{小見出し \label{sec:1}}
これが人間の飲む煙草たばこというものである事はようやくこの頃知った.この書生の掌の裏うちでしばらくはよい心持に坐っておったが,しばらくすると非常な速力で運転し始めた.書生が動くのか自分だけが動くのか分らないが無暗むやみに眼が廻る.

\mySubsubsection{小小見出し}
胸が悪くなる.到底とうてい助からないと思っていると,どさりと音がして眼から火が出た.それまでは記憶しているがあとは何の事やらいくら考え出そうとしても分らない.


\newpage
\section{要素}

\mySubsection{図}

\mySubsubsection{標準}
\begin{figure}[H]
	\centering
	\iffigure
	\includegraphics[clip, width=8cm]{./img/img.jpg}
	\fi
	\caption{図 \label{fig:img_1}}
\end{figure}

\mySubsubsection{横並び}
\begin{figure}[H]
	\begin{minipage}{0.5\hsize}
		\centering
		\iffigure
		\includegraphics[height=50mm]{./img/img.jpg}
		\fi
		\caption{左図 \label{fig:img_left}}
	\end{minipage}
	\begin{minipage}{0.5\hsize}
		\centering
		\iffigure
		\fi
		\includegraphics[height=50mm]{./img/logo.pdf}
		\caption{右図 \label{fig:img_right}}
	\end{minipage}
\end{figure}

\mySubsection{表}

\begin{table}[H]
	\centering
	\renewcommand{\arraystretch}{0.8}
	\caption{表 \label{table:table_1}}
	\small
	% \scriptsize
	\begin{tabular}{lcccccccccccc}
	% \hline
	\toprule
	\multicolumn{1}{c}{~}                                & \multicolumn{1}{c}{~}
	& \multicolumn{1}{c}{\multirow{2}{*}{\textbf{記号}}} & \multicolumn{1}{c}{~}
	& \multicolumn{1}{c}{\multirow{2}{*}{\textbf{単位}}} & \multicolumn{1}{c}{~}
	& \multicolumn{7}{c}{\textbf{ケース}} \\

	\multicolumn{1}{c}{~}                                & \multicolumn{1}{c}{~}
	& \multicolumn{1}{c}{}                               & \multicolumn{1}{c}{~}
	& \multicolumn{1}{c}{}                               & \multicolumn{1}{c}{~}
	& \multicolumn{1}{c}{\textbf{I}}                     & \multicolumn{1}{c}{~}
	& \multicolumn{1}{c}{\textbf{I\hspace{-0.1em}I}}     & \multicolumn{1}{c}{~}
	& \multicolumn{1}{c}{\textbf{I\hspace{-0.1em}I\hspace{-0.1em}I}}
													     & \multicolumn{1}{c}{~}
	& \multicolumn{1}{c}{\textbf{I\hspace{-0.1em}V}} \\
	\midrule
	\textbf{GSD}
			& & GSD         & & m
					& & 200 & & 30 & & 30 & & 6 \\
	\textbf{軌道高度}
			& & $h$         & & km
					& & \multicolumn{7}{c}{35786 (GEO)} \\
	\textbf{観測波長}
			& & $\lambda$   & & $\mu$m
					& & \multicolumn{3}{c}{4(赤外線)} & & \multicolumn{3}{c}{0.4-0.7(可視光)} \\
	\textbf{検出器画素ピッチ}
			& & $p$         & & $\mu$m
					& & 18 & & 18 & & 5.3 & & 5.3 \\
	\textbf{焦点距離}
			& & $f$         & & m
					& & 3.22 & & 21.5 & & 6.32 & & 31.6 \\
	\bottomrule
	\end{tabular}
	\renewcommand{\arraystretch}{1}
\end{table}

\mySubsection{数式}
普通の数式は,{\fontConsolas{equnarray}}環境ではなく,{\fontConsolas{align}}環境を使う.
\begin{align}
	\begin{bmatrix}
		A \\
		B
	\end{bmatrix} = \frac{I_S \Omega(t_{1/2})}{\varDelta t}
	\begin{bmatrix}
		\alpha(t_{1/2}) - \alpha_s & -\left( \delta(t_{1/2}) - \delta_s \right) \\
		\delta(t_{1/2}) - \delta_s & \alpha(t_{1/2}) - \alpha_s
	\end{bmatrix}^{-1}
	\begin{bmatrix}
		\varDelta \alpha \\
		\varDelta \delta
	\end{bmatrix}
\end{align}
式番号を最終行のみ.
\begin{align}
	d_k(x) & = \sum_{x' \in \chi}{f(x')s_k(x-x')} + n_k(x) \notag \\
	& = f \ast s_k(x) + n_k(x) \label{eq:eq_1}
\end{align}
{\fontConsolas{alignat}}環境.
\begin{alignat}{2}
	&Z_{n}^{m}(r,\theta) && = \sqrt{2(n+1)} R_{n}^{m}(r)
	\begin{cases}
		\cos{(\left|m\right|\theta)} &  : m \geq 0 \\
		\sin{(\left|m\right|\theta)} &  : m < 0
	\end{cases} \\
	&R_{n}^{\pm m}(r)    && = \sum_{s=0}^{(n-m)/2} {\frac{(-1)^s (n-s)!}{s! (\frac{n+m}{2} - s)! (\frac{n-m}{2} - s)!} r^{n-2s}}
\end{alignat}

\mySubsection{ソースコード}
\begin{spacing}{0.8}
% \renewcommand{\baselinestretch}{0.8} % 行間の倍率指定
\begin{footnotesize}
\begin{ttfamily}
\begin{fontConsolas}
\noindent
~~~~~~\#define~FLASH\_BLOCK\_NUM\_~~~~~~~~~~~~~~(8192~*~2)\\
~~~~~~\#define~FLASH\_ALTERNATE\_BLOCK\_NUM\_~~~~(100)~~//~暫定値\\
~~~~~~\#define~FLASH\_STORAGE\_BLOCK\_NUM\_~~~~~~(FLASH\_BLOCK\_NUM\_~-~FLASH\_ALTERNATE\_BLOCK\_NUM\_)\\
~~~~~~\\
~~~~~~// 論理block - 物理block変換テーブル : 2~byte~*~FLASH\_STORAGE\_BLOCK\_NUM\_\\
~~~~~~static~unsigned~short~logical\_2\_physical\_block\_table\_[FLASH\_STORAGE\_BLOCK\_NUM\_]\\
~~~~~~// 代替block使用状況保存テーブル : 1~byte~*~FLASH\_ALTERNATE\_BLOCK\_NUM\_\\
~~~~~~static~unsigned~char~~is\_alternate\_block\_available\_[FLASH\_ALTERNATE\_BLOCK\_NUM\_]\\
~~~~~~\\
~~~~~~// 最大テーブル使用サイズは,2 * 8192 * 2 = 32 768 byte.
\end{fontConsolas}
\end{ttfamily}
\end{footnotesize}
% \renewcommand{\baselinestretch}{1.0}
\end{spacing}

\mySubsection{箇条書き}
\begin{itemize}
	\setlength{\leftskip}{-15pt}
	\item[・] 箇条書き
	\item[・] 箇条書き
	\begin{itemize}
		\setlength{\leftskip}{-10pt}
		\item item1
		\item {\fontConsolas{code 012345}}
		\begin{itemize}
			\setlength{\leftskip}{-5pt}
			\item[{\normalfont\bfseries --}] 要素1
			\item[{\normalfont\bfseries --}] 要素2
		\end{itemize}
		\item item3
	\end{itemize}
	\item[・] 箇条書き
\end{itemize}

\mySubsection{参照}
参照.◯◯は\cite{FourierOptics}による.□□は\cite{Bandyopadhyay2016}による.△△は\cite{Zernike}による.
◯◯は \refSec{sec:1} \refFig{fig:img_1} \refFig{fig:img_left} \refTable{table:table_1} \refEq{eq:eq_1} \refApd{apd:apd_1}など.

\newpage
\appendix
\renewcommand{\thefigure}{\Alph{section}.\arabic{figure}}
\renewcommand{\thetable}{\Alph{section}.\arabic{table}}
\renewcommand{\theequation}{\Alph{section}.\arabic{equation}}

\section{付録タイトル \label{apd:apd_1}}
\mySubsection{付録見出し -- 図}
図は次のようになる.
\begin{figure}[H]
	\centering
	\iffigure
	\includegraphics[clip, width=8cm]{./img/img.jpg}
	\fi
	\caption{図 \label{fig:img_2}}
\end{figure}

\mySubsection{付録見出し - 式}
式は次のようになる.
\begin{alignat}{2}
	&Z_{n}^{m}(r,\theta) && = \sqrt{2(n+1)} R_{n}^{m}(r)
	\begin{cases}
		\cos{(\left|m\right|\theta)} &  : m \geq 0 \\
		\sin{(\left|m\right|\theta)} &  : m < 0
	\end{cases} \\
	&R_{n}^{\pm m}(r)    && = \sum_{s=0}^{(n-m)/2} {\frac{(-1)^s (n-s)!}{s! (\frac{n+m}{2} - s)! (\frac{n-m}{2} - s)!} r^{n-2s}}
\end{alignat}


% \section{出典・参考文献}
% 自動でつく「参考文献」を消す
% \renewcommand{\refname}{}
% \vspace{-30pt}
\bibliographystyle{jplain}
\bibliography{bibdata}

\newpage
\mySubsection{レイアウト}
\vspace{20pt}
\layout

\end{document}

Preview
LuaTeX preview
LuaTeX LaTeX Template | Bibby | Bibby AI