mirror of
https://github.com/Wandmalfarbe/pandoc-latex-template.git
synced 2024-12-19 06:17:51 +00:00
Added example boxes-with-pandoc-latex-environment-and-tcolorbox
This example shows how to render beautiful boxes with the filter `pandoc-latex-environment` and the package `tcolorbox`.
This commit is contained in:
parent
84c0d9da68
commit
948150d172
@ -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:
|
||||
|
@ -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
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 175 KiB |
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user