LoginSignup
0
2

More than 1 year has passed since last update.

LaTeXメモ

Last updated at Posted at 2021-11-04

環境

Cloud LaTeXとVSCodeの拡張機能を使用しています
https://github.com/cloudlatex-team/cloudlatex-vscode-extension/blob/master/docs/README_ja.md

OverLeafに変えました.

ファイル

  • main.tex
    • メインドキュメント
  • latexmkrc
    • コンパイラを指定するファイル.Overleafを使用する際は必須
  • .sty
    • スタイルファイル

テンプレート

main.tex

main.tex
\RequirePackage{plautopatch}
\RequirePackage[l2tabu, orthodox]{nag}

\documentclass[platex,dvipdfmx]{jlreq}			% for platex
% \documentclass[uplatex,dvipdfmx]{jlreq}		% for uplatex
\usepackage{graphicx}
\usepackage{here} % 図用
\usepackage{amsmath} % 数式改行用
\usepackage{amssymb} % 数式の記号

\title{}
\author{name}
\date{実験実施日}

\begin{document}
\maketitle

\tableofcontents % 目次(任意)

% 本文 %

\bibliographystyle{plain}
\bibliography{citation} % citation.blbという文献用ファイルを用意する
\nocite{*} % これつけないと文献リストが出ない

\end{document}

注意事項・Tips

  • 画像を挿入するときは、一回挿入するたびにコンパイルしないとエラーになる
  • 2行改行すると段落が変わる

箇条書き、リスト

% 基本
\begin{itemize}
    \item 運動の第一法則とは,慣性の法則のことです.
    \item 運動の第二法則とは,運動方程式のことです.
    \item 運動の第三法則とは,作用反作用の法則のことです.
\end{itemize}

% 記号の変更
\begin{itemize}
    \item[$\clubsuit$] 運動の第一法則とは,慣性の法則のことです.
    \item[$F=ma$] 運動の第二法則とは,運動方程式のことです.
    \item[文字もOK] 運動の第三法則とは,作用反作用の法則のことです.
\end{itemize}

% 番号
\begin{enumerate}
   \item 運動の第一法則とは,慣性の法則のことです.
   \item 運動の第二法則とは,運動方程式のことです.
   \item 運動の第三法則とは,作用反作用の法則のことです.
\end{enumerate}

% 見出しの後に改行
\begin{description}
   \item[運動の第一法則]\mbox{}\\
            慣性の法則のことです.運動方程式が成り立つ座標系を慣性系と言います.
            多くの場合,地球に固定された座標系(実験室系)が良い近似として使われま
            す.
   \item[運動の第二法則]\mbox{}\\
	    運動方程式のことです.
   \item[運動の第三法則]\mbox{}\\
	    作用反作用の法則のことです.
\end{description}

数式

数式環境(amsmath)

参考になる→https://tm23forest.com/contents/latex-amsmath-guide-with-svg-outputexample

数式の記述方法

インライン数式

文中でギリシャ文字を使いたいときやちょっとした数式を入れたいときに用いる

$x + x = 2x$

基本の数式

\begin{equation}
	%数式
\end{equation}

数式を改行、式番号を分割

\usepackage{amsmath} % 数式改行用

\begin{gather}
    Y_0 = \bar{A}\cdot\bar{B}\cdot\bar{C} \\
    Y_1 = \bar{A}\cdot\bar{B}\cdot C \\
    Y_2 = \bar{A}\cdot B \cdot \bar{C} \\
    Y_3 = \bar{A}\cdot B \cdot C \\
    Y_4 = A \cdot \bar{B} \cdot \bar{C} \\ 
    Y_5 = A \cdot \bar{B} \cdot C  \\
    Y_6 = A \cdot B \cdot \bar{C} \\
    Y_7 = A \cdot B \cdot C
\end{gather}

イコールをそろえる、かつ、式番号一つ

\begin{equation}
	\begin{split}
		V &= \mathbf{B}\cdot\mathbf{S} \\
		&= BScos \omega t
	\end{split}
\end{equation}

イコールをそろえる、かつ、式番号分割

\begin{align}
	V &= \mathbf{B}\cdot\mathbf{S} \\
	&= BScos \omega t
\end{align}

式番号を参照

\begin{align}
	V &= \mathbf{B}\cdot\mathbf{S} \label{eq:a}\\ % 参照したい行に\labelを設定
	&= BScos \omega t
\end{align}

演算子、記号など

括弧の大きさを自動で適切なサイズに

分数などで括弧を自然な大きさにしたいときに用いる

\left( \right)

分数

\frac{a}{b} % a/b

ルート

\sqrt{a}

積分、偏微分

\int_{a}^{b} % 積分範囲a~bのインテグラル
\partial % 偏微分

近似、合同

\approx % 約
\equiv % 合同

ギリシャ文字(μ)、筆記体、ダッシュ(´)

\mu 
\ell %筆記体のl
\prime % ダッシュ

ゆえに、なぜなら

\usepackage{amssymb}

\therefore
\because

行列

丸かっこの行列

\begin{pmatrix}
a & b \\
c & d \\
\end{pmatrix}

角かっこの行列

\begin{bmatrix}
a & b \\
c & d \\
\end{bmatrix}

[TODO]文献リストの作成方法

文献リストを表示するには.bibというファイルを用意する必要があります。
私はJabRefというソフトを使ってアーカイブを管理し、文献リストを作っています。
しかし、参考文献が少ないので手打ちでも良いという場合は以下のテンプレートを参考にして
VSCodeでmain.texと同じディレクトリに.bibファイルを作ってください。

citation.bib
@book{book1,
  author    = {Yamada},
  publisher = {ほげほげ出版},
  title     = {ほげほげ入門},
  year      = {2022}
}
@book{article1,
  author = {著者名},
  title = {webページのタイトル},
  publisher = {Webサイトの名称},
  year = {更新日時},
  address = {URL},
  note = {閲覧日時}
  }
  • @bookは文献の種類です。
  • book1, article1などは参照名です。
  • author, title, publisher, yearなどは@bookの必須欄です。
  • @bookは汎用性が高いです。

文献の種類

必須欄とありますが、CloudLaTeXでは無くてもコンパイルできました。
なぜかはわかりませんが。

  • @book
    • 必須欄:author, title, publisher, year
    • その他の欄:volume, number, series, address, edition, month
  • 論文・雑誌記事 @journal
    • 必須欄:author, title, jouranl, year
    • その他の欄:volume, number, pages, month, note
  • サイトや出版社・著者の分からない本とか @booklet
    • 必須欄:title
    • その他の欄:author, howpublished, address, month, year, note
  • なんでも @misc
    • 必須欄:なし
    • その他の欄:author, title, howpublished, month, year, note

参考になりそう

その他

太字

\textbf{}

丸1(①)を出力する

\textcircled{\scriptsize 1}

画像

  • [H]は文中に画像を挿入するために指定しており、これを使用するために\usepackage{here}をしている。
  • 画像を挿入するときはプロジェクトフォルダに1枚入れるごとにコンパイルしないとエラーになるので注意。
  • \includegraphics[clip,width=15.0cm]{fig/dcmotor.jpg}は画像のパスや大きさを指定します。
\usepackage{here} % 図用

\begin{figure}[H] 
	\centering
	\includegraphics[clip,width=15.0cm]{fig/dcmotor.jpg}
	\caption{name}
	\label{fig:dc1}
\end{figure}

\usepackage{here} % 図用

\begin{table}[H]
	\centering
	\caption{回転数測定結果}
	\label{tab:my-table}
	\begin{tabular}{ll||l|l|l}
		& 電圧 {[}V{]}           & 10  & 15  & 19  \\
		\hline \hline
		オシロスコープ  & 回転数 {[}rotate/min{]} & 390 & 540 & 590 \\
		\hline
		モータ制御ボード & 回転数 {[}rotate/min{]} & 430 & 570 & 710 \\
	\end{tabular}
\end{table}

画像を表として使う

私は表組みは面倒な場合はExcelなどで作った表をスクショした画像を表として使っています。

\begin{table}[H]
	\centering
	\caption{回転数測定結果}
	\includegraphics[clip,width=15.0cm]{fig/dcmotor.jpg}
	\label{tab:my-table}
\end{table}

番号を振らない章(section)の追加

\section*{謝辞}

目次に追加したいときは以下を上記の次の行に書けばよい

\addcontentsline{toc}{section}{謝辞}

Overleafにおいて複数ファイルを選択して削除する方法

ファイルツリー上でCtrlを長押ししながら削除したいファイルを選択した後にゴミ箱アイコンをクリック

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2