0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【備忘録】Texでよく使うコマンド

Last updated at Posted at 2023-01-29

はじめに

本記事では、筆者が日頃から使うTexのコマンドを列挙していく。筆者の備忘録代わりである。また、内容については筆者も利用するので、適宜編集をしていくつもりである。

使用環境

それぞれのバージョンに関しては、追記する際の変更が手間であるので、割愛する。

  • M1 MacBook(2020)
  • macOS
  • VScode
  • MacTex

documentclass

\documentclass[]{ltjsarticle}

必要があれば、twocolumn[]の中に挿入し、2段組にしている。

プリアセンブリ

Fig.Table.

図や表をFig.やTable.に変更する。

\renewcommand{\figurename}{Fig.}
\renewcommand{\tablename}{Table.}

footnote

記号の変更

footnoteを某T大のある先生風にするため、筆者は以下のコマンドによってf脚注に使用される記号を再定義している。

\renewcommand{\thefootnote}{\dag\arabic{footnote}}

脚注の線の変更(拡張)

なお、数値を変更することで、脚注の線の長さや太さが変化するので、試してみると良い。

\renewcommand{\footnoterule}{\noindent\rule{\textwidth}{0.05mm}\vskip2mm}

リンク

目次や図、表のリンクをさせるために、

\usepackage{hyperref}

を利用し、それを目立たないようにするため、以下の設定を施している。
(標準設定では、筆者の環境ではリンクに赤枠が出てきてしまい、あまり見た目が良くないと考えている。)

\hypersetup{
setpagesize=false,
 bookmarksnumbered=true,%
 bookmarksopen=true,%
 colorlinks=true,%
 linkcolor=black,
 citecolor=black,
}

\begin{document}

abstract

2段組の文書で、abstructのみを1段組にするためには、以下のように記述する。

\twocolumn [
\maketitle
\begin{abstract}
    ここに、内容を記述する。
\end{abstract}
]

なお、この際に\usepackage{abstract}を使うとabstractが綺麗になる。

目次の作成

Texで目次の作成を行うには、以下のコマンドを入力する。

\tableofcontents
\clearpage

なお、\clearpageは目次を見やすくするために筆者は入れている。

図の挿入

図の挿入をする場合、

\usepackage{graphicx}

でpackageを指定したのちに以下のコマンドを使用する。

\begin{figure}[h]
    \centering
    \includegraphics[width=0.3\textwidth]{fig-v12.png}
    \caption{v12}
    \label{fig-v12}
\end{figure}

なお、ここで\textwidthとは、文字を書けるスペースの横幅を指している。それの0.3倍と横幅にするという意味である。

bibTex

bibTexを使った参考文献の記入には、以下のコマンドを\end{document}の手前に追記する。なお、refには、ファイルの名称(拡張子を除く)を挿入する。筆者はいつもref.bibtexという名前のファイルを利用しているため、以下のようなコマンドになる。

\clearpage
\bibliographystyle{abbrv} %日本語の場合は jabbrv などとする
\bibliography{ref}

なお、\clearpageは目次を見やすくするために筆者は入れている。

citation

いくつかの引用文献は1つの文章で表示する際に、

\usepackage{cite}

を使用することで、以下の図のような引用が可能となる。
なお、ハイフンについては連番になっている際のみ有効となる。
Screenshot 2023-02-01 at 14.53.05.png

errrow

There's no line here to end.

エラーが出ているところに\leavevmodeを追記する。

0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?