Open14
Latexメモ

- jsarticle
- 章のないレポート用
- jsbook
- 書籍用
- 章の概要用?
- ページ番号が右上
- jsreport
- 2017年から
- 章のあるレポート用
- 文章の概要用?
- ページ番号が真ん中下
\documentclass[uplatex,14pt]{jsreport}

1行の文字数・1ページの行数の設定方法
% 文字数制限の設定
\makeatletter
\def\maxcharsperline#1{
\newcounter{mpl}
\setcounter{mpl}{#1}
\@tempdima=\linewidth
\advance\@tempdima by-\value{mpl}zw
\addtocounter{mpl}{-1}
\divide\@tempdima by \value{mpl}
\advance\kanjiskip by\@tempdima
\advance\parindent by\@tempdima
}
\makeatother
% 行数制限の設定
\def\maxlinesperpage#1{
\baselineskip=\textheight
\divide\baselineskip by #1
}
% 1行の文字数
\maxcharsperline{30}
% 1ページ当たりの行数指定
\maxlinesperpage{35}

画像の入れ方
% 画像関係
\usepackage[dvipdfmx]{graphicx}
\usepackage{float}
\begin{figure}[H]
\centering
\includegraphics[width=0.5\linewidth]{images/xxx.png}
\caption{xxx}
\label{fig:xxx}
\end{figure}

目次の出力
%subsectionまで表示する subsubsectionは{3}
\setcounter{tocdepth}{2}
% 目次の出力
\tableofcontents

特殊記号をそのまま出力する方法
特殊記号
$ % & _ { } \ ^ ~ < > |
\verb|&|
\_

uplatexをVS Codeで使う方法

VS Codeでpdfの出力先を変更

目次のページ番号と本文のページ番号を分ける方法
% 目次の出力
\pagenumbering{roman} % ページ番号をローマ数字に設定
\setcounter{tocdepth}{2} %subsectionまで表示する
\tableofcontents
\clearpage
\pagenumbering{arabic} % ページ番号をアラビア数字に設定
% 本文

日本語化
latexmkrc (Unicode対応版)
$latex = 'uplatex';
$bibtex = 'upbibtex';
$dvipdf = 'dvipdfmx %O -o %D %S';
$makeindex = 'mendex -U %O -o %D %S';
$pdf_mode = 3;
\documentclass[uplatex,14pt]{jsreport}

文字の大きさの変え方
\tiny - 非常に小さいサイズ
\scriptsize - スクリプトサイズ(小さい)
\footnotesize - 脚注に使われるサイズ
\small - 小さいサイズ
\normalsize - 標準のサイズ
\large - 大きいサイズ
\Large (Lは大文字) - より大きいサイズ
\LARGE - さらに大きいサイズ
\huge - 非常に大きいサイズ
\Huge - 最大のサイズ

章の文字列の余白を調整する
上部の余白を-50pt
下部の余白を20pt
\usepackage{titlesec}
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{\chaptertitlename\thechapter 章}{20pt}{\Huge}
\titlespacing*{\chapter}{0pt}{-50pt}{20pt}
最初の段落を字下げする
\usepackage{indentfirst}

図の位置
\begin{figure}[位置]
位置
h 記述した場所
t ページの上部
b ページの下部

引用
Kademlia\cite{maymounkov2002kademlia}
\bibliographystyle{junsrt}
\bibliography{references}
references.bib
@inproceedings{maymounkov2002kademlia,
title={Kademlia: A peer-to-peer information system based on the xor metric},
author={Maymounkov, Petar and Mazieres, David},
booktitle={International workshop on peer-to-peer systems},
pages={53--65},
year={2002},
organization={Springer}
}

太字
% ゴシック体太字
\textgt{}
% 明朝体太字
\textbf{}
作成者以外のコメントは許可されていません