Skip to content

Instantly share code, notes, and snippets.

@mountcedar
Last active October 30, 2018 01:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mountcedar/7006977 to your computer and use it in GitHub Desktop.
Save mountcedar/7006977 to your computer and use it in GitHub Desktop.
MarkdownとPandocを用いた簡易Latex環境の構築 ref: https://qiita.com/mountcedar/items/e7603c2eb65661369c3b

はじめに

これはテストです。書式はgithubのmarkdownを採用しています。

いろいろな書式

subsection的な

  • 箇条書きも対応してほしい
  • itemizeとか毎回書くのまじでしんどい
    • 入れ子とかもサポートしてくれると良いよね

subsubsection的な

  1. もちろん、数字のサポートも必須でしょ
    • 違うアイテマイズの入れ子ももちろんサポートするよね

リンク関係

リンクはどうなるの?

画像とかはどうなるの?

文字書式

  • これはイタリック体です*
  • これもイタリック体です
  • これはイタリック体になりません
  • これは太字です
  • これも太字です

引用はどうなるんだろう

表はどうなる

カラム1 カラム2
hoge geho
\section{はじめに}\label{はじめに}
これはテストです。書式はgithubのmarkdownを採用しています。
\section{いろいろな書式}\label{いろいろな書式}
\subsection{subsection的な}\label{subsection的な}
\begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt
\item
箇条書きも対応してほしい
\item
itemizeとか毎回書くのまじでしんどい
\begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt
\item
入れ子とかもサポートしてくれると良いよね
\end{itemize}
\end{itemize}
\subsubsection{subsubsection的な}\label{subsubsection的な}
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\itemsep1pt\parskip0pt\parsep0pt
\item
もちろん、数字のサポートも必須でしょ
\begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt
\item
違うアイテマイズの入れ子ももちろんサポートするよね
\end{itemize}
\end{enumerate}
\section{リンク関係}\label{リンク関係}
\href{http://localhost}{リンクはどうなるの?}
\begin{figure}[htbp]
\centering
\includegraphics{sample.png}
\caption{画像とかはどうなるの?}
\end{figure}
\section{文字書式}\label{文字書式}
\begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt
\item
これはイタリック体です*
\item
\emph{これもイタリック体です}
\item
これはイタリック体になりません
\item
\textbf{これは太字です}
\item
\textbf{これも太字です}
\end{itemize}
\begin{quote}
引用はどうなるんだろう
\end{quote}
\section{表はどうなる}\label{表はどうなる}
\begin{longtable}[c]{@{}ll@{}}
\hline\noalign{\medskip}
カラム1 & カラム2
\\\noalign{\medskip}
\hline\noalign{\medskip}
hoge & geho
\\\noalign{\medskip}
\hline
\end{longtable}
$ pandoc readme.md -o readme.tex
$ platex manuscript.tex
$ dvipdfmx manuscript.dvi
$ pdflatex manuscript.tex
# -*- makefile -*-
TEX=platex
DVI2PDF=dvipdfmx
SOURCES = \
manuscript.tex \
$(NULL)
MDSCRIPT = \
contents.md \
$(NULL)
all: convertmd dvi2pdf clean
convertmd: $(MDSCRIPT)
@cat $^ \
| sed s/.png/.eps/g \
| pandoc -t latex \
| sed 's/includegraphics/includegraphics[width=1.0\\columnwidth]/g' \
| sed 's/\[htbp\]/\[t\]/g' \
> $(MDSCRIPT:.md=.tex)
.tex.dvi: convertmd
@${TEX} $<
@${TEX} $<
dvi2pdf: $(SOURCES:.tex=.dvi)
@${DVI2PDF} $^
clean:
@rm -f *.dvi *.aux *.log
\documentclass[11pt,a4paper,twocolumn]{jarticle}
%
\usepackage{amsmath,amssymb}
\usepackage{bm}
\usepackage{graphicx}
\usepackage{ascmac}
\usepackage[dvipdfm]{hyperref}
\title {Weekly Report}
\author {Yamamoto Tarou}
\begin {document}
\maketitle
\input {readme}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment