CCWO Embedded Space

CCWOの日々の開発を発信するブログ

LaTeX テンプレート

TeXをWindows上でコンパイル→プレビューできるようにしたので、テンプレートを2つ作りました。
ついでにVSCodeの操作の注意点もまとめておきます。

VSCodeでのコンパイルは基本的には、プラグインが正常に動作していれば
・保存
・右クリック→build LaTeX project
・Ctr+L→Ctr+B
の3つの方法があります。
成功すれば
LaTeX build toolchain step 1→LatTeX build succeeded
と下のバーに表示されます。
エラーのときは赤字でerrorもしくはLaTeX build toolchain step 1で止まります。
このとき、たいしたエラーチェックはでないので少しずつ確認するほうが吉だと思います。
ビルドが成功すればプレビューは、
Ctr+L→Ctr+T 別のタブで表示
Ctr+L→Ctr+V ブラウザで表示
で可能です。非常に簡単。

テンプレート1
1カラム ショート

% ドキュメント設定
\documentclass[a4j,11pt]{jarticle}

% 余白設定
\setlength{\topmargin}{-0.5in}
\setlength{\oddsidemargin}{-5mm}
\setlength{\evensidemargin}{-19mm}
\setlength{\textwidth}{180mm}
\setlength{\textheight}{253mm}

% パッケージ設定
\usepackage[dvips]{graphicx}
\usepackage{tabularx}
\usepackage{subfigure}
\usepackage{fancyhdr}
\usepackage{comment}

% ページ番号設定
\renewcommand{\thepage}{--- \arabic{page} ---}

% ヘッダー設定
\pagestyle{fancy}
% \pagestyle{plain} % ページ番号表示
\lhead{} % 左上
\chead{} % 上
\rhead{Seminar} % 右上
%\lfoot{} % 左下
%\cfoot{} % 下
%\rfoot{} % 右下
\renewcommand{\headrulewidth}{0.0pt}

% タイトル設定
\title{Seminar\\theme}
\author{Name}
\date{Month Date, Year}

% 本文
\begin{document}
    % \maketitle
    % タイトル
    \begin{center}
    {\huge{Seminar}} % タイトル
    \\{\large{Theme}} % サブタイトル
    \end{center}
    \begin{flushleft}
    \end{flushleft}
    \begin{flushright}
    Month Date, Year % 日付
    \\Name % 名前
    \end{flushright}

    % 章
    \section{title 1}
    chapter1
    \subsection{title 1.1}
    sub chapter1.1
    \subsection{title 1.2}
    sub chapter1.2
    \section{title 2}
    chapter2
    \subsection{title 2.1}
    sub chapter2.1
    \subsection{title 2.2}
    sub chapter2.2
    % \newpage
\end{document}

テンプレート2
2カラム ショート

% ドキュメント設定
\documentclass[a4j,11pt]{jarticle}

% 余白設定
\setlength{\topmargin}{-0.5in}
\setlength{\oddsidemargin}{-5mm}
\setlength{\evensidemargin}{-19mm}
\setlength{\textwidth}{180mm}
\setlength{\textheight}{253mm}
\setlength{\columnsep}{0.4pt}
\setlength{\columnseprule}{0pt}

% パッケージ設定
\usepackage[dvips]{graphicx}
\usepackage{tabularx}
\usepackage{subfigure}
\usepackage{fancyhdr}
\usepackage{multicol}
\usepackage{comment}

% ページ番号設定
\renewcommand{\thepage}{--- \arabic{page} ---}

% ヘッダー設定
\pagestyle{fancy}
% \pagestyle{plain} % ページ番号表示
\lhead{} % 左上
\chead{} % 上
\rhead{Seminar} % 右上
%\lfoot{} % 左下
%\cfoot{} % 下
%\rfoot{} % 右下
\renewcommand{\headrulewidth}{0.0pt}

% タイトル設定
\title{Seminar\\theme}
\author{Name}
\date{Month Date, Year}

% 本文
\begin{document}
    % \maketitle
    % タイトル
    \begin{center}
    {\huge{Seminar}} % タイトル
    \\{\large{Theme}} % サブタイトル
    \end{center}
    \begin{flushleft}
    \end{flushleft}
    \begin{flushright}
    Month Date, Year % 日付
    \\Name % 名前
    \end{flushright}

    % 章
    \begin{multicols}{2}
        \section{title 1}
        chapter1
        \subsection{title 1.1}
        sub chapter1.1
        \subsection{title 1.2}
        sub chapter1.2
        \section{title 2}
        chapter2
        \subsection{title 2.1}
        sub chapter2.1
        \subsection{title 2.2}
        sub chapter2.2
        % \columnbreak
    \end{multicols}
\end{document}

依存関係で\maketitleや\pagestyle{plain}などがコメントアウトなどしてあります。
fancy styleを用いるとうまく両方を共存させられなかったりしたので。
こんな感じでテンプレート2つとりあえず作りました。


2017/06/18の記事