diff --git a/.travis.yml b/.travis.yml index f38f62c..ba822f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,6 +53,9 @@ before_install: # packages only needed for some examples (that include packages via header-includes) - tlmgr install awesomebox fontawesome5 + + # packages only needed for some examples (example boxes-with-pandoc-latex-environment-and-tcolorbox) + - tlmgr install tcolorbox pgf verbatim etoolbox environ before_script: - cd examples script: diff --git a/examples/boxes-with-pandoc-latex-environment-and-tcolorbox/boxes-tcolorbox.md b/examples/boxes-with-pandoc-latex-environment-and-tcolorbox/boxes-tcolorbox.md new file mode 100644 index 0000000..0d1d7ae --- /dev/null +++ b/examples/boxes-with-pandoc-latex-environment-and-tcolorbox/boxes-tcolorbox.md @@ -0,0 +1,78 @@ +--- +title: "Boxes with pandoc-latex-environment and tcolorbox" +author: [Author] +date: "2020-01-01" +subject: "Markdown" +keywords: [Markdown, Example] +lang: "en" +colorlinks: true +header-includes: +- | + ```{=latex} + \usepackage{tcolorbox} + + \newtcolorbox{info-box}{colback=cyan!5!white,arc=0pt,outer arc=0pt,colframe=cyan!60!black} + \newtcolorbox{warning-box}{colback=orange!5!white,arc=0pt,outer arc=0pt,colframe=orange!80!black} + \newtcolorbox{error-box}{colback=red!5!white,arc=0pt,outer arc=0pt,colframe=red!75!black} + ``` +pandoc-latex-environment: + tcolorbox: [box] + info-box: [info] + warning-box: [warning] + error-box: [error] +... + +# Boxes with `pandoc-latex-environment` and `tcolorbox` + +This example demonstrates the use of the filter [`pandoc-latex-environments`] +to create custom boxes with the [`tcolorbox`] package. +*pandoc-latex-environment* is a pandoc filter for adding LaTeX environement on +specific HTML div tags. For a list of all available options visit the +[`tcolorbox` documentation](https://ctan.org/pkg/tcolorbox). + +## Simple Box + +::: box +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam aliquet libero +quis lectus elementum fermentum. +::: + +## Markdown inside the Box + +Markdown formatting inside the environment is supported. + +::: box +Lorem ipsum **dolor** sit amet, `consectetur adipiscing` elit. + +``` +if(args.length < 2) { + System.out.println("Lorem ipsum dolor sit amet"); +} +``` + +*Nam aliquet libero +quis lectus elementum fermentum.* +::: + +## Custom Box + +One can define custom boxes in the LaTeX preamble with the variable +`header-includes` at the top of this document. + +::: info +**Info**: This is a custom box that may be used to show info messages in your +document. +::: + +::: warning +**Warning**: This is a custom box that may be used to show warning messages in +your document. +::: + +::: error +**Error**: This is a custom box that may be used to show error messages in your +document. +::: + +[`pandoc-latex-environments`]: https://github.com/chdemko/pandoc-latex-environment/ +[`tcolorbox`]: https://ctan.org/pkg/tcolorbox \ No newline at end of file diff --git a/examples/boxes-with-pandoc-latex-environment-and-tcolorbox/boxes-tcolorbox.pdf b/examples/boxes-with-pandoc-latex-environment-and-tcolorbox/boxes-tcolorbox.pdf new file mode 100644 index 0000000..606c4ac Binary files /dev/null and b/examples/boxes-with-pandoc-latex-environment-and-tcolorbox/boxes-tcolorbox.pdf differ diff --git a/examples/boxes-with-pandoc-latex-environment-and-tcolorbox/boxes-tcolorbox.png b/examples/boxes-with-pandoc-latex-environment-and-tcolorbox/boxes-tcolorbox.png new file mode 100644 index 0000000..d7f5772 Binary files /dev/null and b/examples/boxes-with-pandoc-latex-environment-and-tcolorbox/boxes-tcolorbox.png differ diff --git a/examples/build-examples.sh b/examples/build-examples.sh index b392852..42d4b28 100644 --- a/examples/build-examples.sh +++ b/examples/build-examples.sh @@ -73,6 +73,10 @@ echo "- boxes-with-pandoc-latex-environment-and-awesomebox" pandoc "boxes-with-pandoc-latex-environment-and-awesomebox/boxes.md" -o "boxes-with-pandoc-latex-environment-and-awesomebox/boxes.pdf" --from markdown --template "../eisvogel.latex" --filter pandoc-latex-environment --listings pdftoppm -r 150 -png "boxes-with-pandoc-latex-environment-and-awesomebox/boxes.pdf" > "boxes-with-pandoc-latex-environment-and-awesomebox/boxes.png" +echo "- boxes-with-pandoc-latex-environment-and-tcolorbox" +pandoc "boxes-with-pandoc-latex-environment-and-tcolorbox/boxes-tcolorbox.md" -o "boxes-with-pandoc-latex-environment-and-tcolorbox/boxes-tcolorbox.pdf" --from markdown --template "../eisvogel.latex" --filter pandoc-latex-environment --listings +pdftoppm -r 150 -png "boxes-with-pandoc-latex-environment-and-tcolorbox/boxes-tcolorbox.pdf" > "boxes-with-pandoc-latex-environment-and-tcolorbox/boxes-tcolorbox.png" + # No lang option (-V lang=zh) here because Chinese is unsupported in polyglossia and babel. # These commands are disabled because the CJK font isn't available on travis. #pandoc "chinese/chinese.md" -o "chinese/chinese.pdf" --from markdown --template "../eisvogel.latex" --listings --pdf-engine=xelatex -V CJKmainfont="HiraginoSans-W4"