diff --git a/Dockerfile b/Dockerfile index 8ee4610..fc29a2e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,7 @@ RUN wget https://github.com/jgm/pandoc/releases/download/2.7.2/pandoc-2.7.2-1-am COPY scripts/ /usr/local/bin/ COPY crossref_config.yaml /config/crossref_config.yaml +COPY listings-setup.tex /config/listings-setup.tex VOLUME /workdir WORKDIR /workdir diff --git a/examples/example.c b/examples/example.c new file mode 100644 index 0000000..c81818b --- /dev/null +++ b/examples/example.c @@ -0,0 +1,5 @@ +#include + +int main(void) { + printf("Hello World\n"); +} diff --git a/examples/example.html b/examples/example.html index 6a2ae93..4a147f4 100644 --- a/examples/example.html +++ b/examples/example.html @@ -188,6 +188,8 @@

7 int main(void) { printf("Hello World\n"); } +

listingsパッケージ

+

    diff --git a/examples/example.md b/examples/example.md index 75eabdc..01e15b0 100644 --- a/examples/example.md +++ b/examples/example.md @@ -124,3 +124,8 @@ int main(void) { printf("Hello World\n"); } ``` + + +listingsパッケージ + +\lstinputlisting[language=c, caption = ソースコード ,label = source]{example.c} diff --git a/examples/example.pdf b/examples/example.pdf index 524ab43..ab7a8b5 100644 Binary files a/examples/example.pdf and b/examples/example.pdf differ diff --git a/listings-setup.tex b/listings-setup.tex new file mode 100644 index 0000000..42e4acf --- /dev/null +++ b/listings-setup.tex @@ -0,0 +1,29 @@ +\usepackage{listings} +\usepackage{xcolor} + +\lstset{ + basicstyle=\ttfamily, + keywordstyle=\color[RGB]{33,74,135}\bfseries, + stringstyle=\color[RGB]{79,153,5}, + commentstyle=\color[RGB]{143,89,2}\itshape, + numberstyle=\footnotesize, + numbers=left, + stepnumber=1, + numbersep=15pt, + backgroundcolor=\color[RGB]{251,251,251}, + frame=single, + frameround=ffff, + framesep=5pt, + rulecolor=\color[RGB]{148,150,152}, + breaklines=true, + breakautoindent=true, + breakatwhitespace=true, + breakindent=25pt, + showspaces=false, + showstringspaces=false, + showtabs=false, + tabsize=2, + captionpos=b, + linewidth=\textwidth, +} + diff --git a/scripts/mdtopdf b/scripts/mdtopdf index b41fea1..062343f 100755 --- a/scripts/mdtopdf +++ b/scripts/mdtopdf @@ -1,6 +1,6 @@ #!/bin/bash str=$1 pandoc -s -N ${str%.*}.md -o ${str%.*}.pdf -V documentclass=ltjarticle --pdf-engine=lualatex \ --F pandoc-crossref \ +-F pandoc-crossref \ -M "crossrefYaml=/config/crossref_config.yaml" \ --V geometry:margin=1in +-V geometry:margin=1in -H /config/listings-setup.tex diff --git a/scripts/mdtotex b/scripts/mdtotex index db05ff0..fca0439 100755 --- a/scripts/mdtotex +++ b/scripts/mdtotex @@ -3,4 +3,4 @@ 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 geometry:margin=1in -H /config/listings-setup.tex