From 65d639e98f21b805c06930de0301dccd2ce029fe Mon Sep 17 00:00:00 2001 From: Dragon-taro Date: Sun, 27 Oct 2019 02:37:25 +0900 Subject: [PATCH] =?UTF-8?q?2columns=E3=81=AE=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 10 +++++++--- README.md | 21 ++++++++++++++++++++- mdtopdf-2cols | 7 +++++++ mdtotex-2cols | 7 +++++++ w-mdtopdf-2cols | 3 +++ w-mdtotex-2cols | 3 +++ 6 files changed, 47 insertions(+), 4 deletions(-) create mode 100755 mdtopdf-2cols create mode 100755 mdtotex-2cols create mode 100755 w-mdtopdf-2cols create mode 100755 w-mdtotex-2cols diff --git a/Dockerfile b/Dockerfile index 86fcfd1..415d4e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,15 +4,19 @@ ENV DEBIAN_FRONTEND=noninteractive ADD mdtopdf /usr/local/bin ADD mdtotex /usr/local/bin +ADD mdtopdf-2cols /usr/local/bin +ADD mdtotex-2cols /usr/local/bin ADD watcher /usr/local/bin ADD w-mdtopdf /usr/local/bin ADD w-mdtotex /usr/local/bin +ADD w-mdtopdf-2cols /usr/local/bin +ADD w-mdtotex-2cols /usr/local/bin ADD crossref_config.yaml /config/crossref_config.yaml RUN apt update && \ - apt upgrade -y && \ - apt install wget texlive-luatex texlive-lang-cjk lmodern texlive-xetex -y && \ - apt-get clean + apt upgrade -y && \ + apt install wget texlive-luatex texlive-lang-cjk lmodern texlive-xetex -y && \ + apt-get clean RUN wget https://github.com/jgm/pandoc/releases/download/2.7.2/pandoc-2.7.2-1-amd64.deb && \ dpkg -i pandoc-2.7.2-1-amd64.deb && \ diff --git a/README.md b/README.md index fd7ed90..c6b5d2b 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ You can see example markdown file and converted PDF file from the link below👇 ## Getting Started 1. Pull docker image. + ```bash $ docker pull plass/mdtopdf ``` @@ -22,29 +23,46 @@ $ docker pull plass/mdtopdf ⚠️ This docker image size is **1.68GB**. I recommend pulling it using the fast Internet connection. 2. Generate PDF file. + ```bash $ docker run -it --rm -v `pwd`:/workdir plass/mdtopdf mdtopdf INPUT.md ``` ## Advanced Usages +### Generate 2 columns PDF file + +```bash +$ docker run -it --rm -v `pwd`:/workdir plass/mdtopdf mdtopdf-2cols INPUT.md +``` + ### Generate PDF file on save ```bash $ docker run -it --rm -v `pwd`:/workdir plass/mdtopdf w-mdtopdf INPUT.md ``` +### Generate 2 columns PDF file on save + +```bash +$ docker run -it --rm -v `pwd`:/workdir plass/mdtopdf w-mdtopdf-2cols INPUT.md +``` + ### Set alias You can decrease typing using `alias` command as below, ```bash $ echo "alias mdtopdf='docker run -it --rm -v `pwd`:/workdir plass/mdtopdf mdtopdf'" >> ~/.bash_profile +$ echo "alias mdtopdf-2cols='docker run -it --rm -v `pwd`:/workdir plass/mdtopdf mdtopdf-2cols'" >> ~/.bash_profile $ echo "alias w-mdtopdf='docker run -it --rm -v `pwd`:/workdir plass/mdtopdf w-mdtopdf'" >> ~/.bash_profile +$ echo "alias w-mdtopdf-2cols='docker run -it --rm -v `pwd`:/workdir plass/mdtopdf w-mdtopdf-2cols'" >> ~/.bash_profile $ source ~/.bash_profile - + $ mdtopdf INPUT.md +$ mdtopdf-2cols INPUT.md $ w-mdtopdf INPUT.md +$ w-mdtopdf-2cols INPUT.md ``` **zsh** : Modify `.zshrc` instead of `.bash_profile`. @@ -54,4 +72,5 @@ $ w-mdtopdf INPUT.md ```bash $ docker run -it --rm -v `pwd`:/workdir plass/mdtopdf mdtotex INPUT.md +$ docker run -it --rm -v `pwd`:/workdir plass/mdtopdf mdtotex-2cols INPUT.md ``` diff --git a/mdtopdf-2cols b/mdtopdf-2cols new file mode 100755 index 0000000..e32f287 --- /dev/null +++ b/mdtopdf-2cols @@ -0,0 +1,7 @@ +#!/bin/bash +str=$1 +pandoc -s -N ${str%.*}.md -o ${str%.*}.pdf -V documentclass=ltjarticle --pdf-engine=lualatex \ +-F pandoc-crossref \ +-M "crossrefYaml=/config/crossref_config.yaml" \ +-V geometry:margin=1in \ +-V classoption=twocolumn diff --git a/mdtotex-2cols b/mdtotex-2cols new file mode 100755 index 0000000..7a07880 --- /dev/null +++ b/mdtotex-2cols @@ -0,0 +1,7 @@ +#!/bin/bash +str=$1 +pandoc -s -N ${str%.*}.md -o ${str%.*}.tex -V documentclass=ltjarticle --pdf-engine=lualatex \ +-F pandoc-crossref \ +-M "crossrefYaml=/config/crossref_config.yaml" \ +-V geometry:margin=1in \ +-V classoption=twocolumn \ No newline at end of file diff --git a/w-mdtopdf-2cols b/w-mdtopdf-2cols new file mode 100755 index 0000000..8b28974 --- /dev/null +++ b/w-mdtopdf-2cols @@ -0,0 +1,3 @@ +#! /bin/bash + +watcher $1 mdtopdf-2cols $1 diff --git a/w-mdtotex-2cols b/w-mdtotex-2cols new file mode 100755 index 0000000..626b542 --- /dev/null +++ b/w-mdtotex-2cols @@ -0,0 +1,3 @@ +#! /bin/bash + +watcher $1 mdtotex-2cols $1