Skip to content

Instantly share code, notes, and snippets.

@Liam0205
Last active March 29, 2020 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Liam0205/969c9cada5a6956707670f5965250c34 to your computer and use it in GitHub Desktop.
Save Liam0205/969c9cada5a6956707670f5965250c34 to your computer and use it in GitHub Desktop.
writing markdown in LaTeX by using the markdown package
# I'm a markdown file.
And I can do *emphasis*.
## With sub-headers
> Block quotes are
> written like so.
>
> They can span multiple paragraphs,
> if you like.
Use 3 dashes for an em-dash. Use 2 dashes for ranges (ex., "it's all
in chapters 12--14"). Three dots ... will be converted to an ellipsis (provided you include the smartEllipses option in your preamble).
Unicode is supported.
## Code blocks
Here's a code sample:
```python
# Let me re-iterate ...
for i in range(10):
# do sth on i
```
## Lists
Now a nested list:
1. First, get these ingredients:
* carrots
* celery
* lentils
2. Boil some water.
3. Dump everything in the pot and follow
this algorithm:
find wooden spoon
uncover pot
stir
cover pot
balance wooden spoon precariously on pot handle
wait 10 minutes
goto first step (or shut off burner when done)
Do not bump wooden spoon or it will fall.
## Links
Here's a link to [a website](https://liam.page). And now^[with `markdown` v2.4] you can also use inlined footnotes with `inlineFootnotes`.
## Figures
Here we can reference \textbf{Figure~\ref{fig:exampleimage}}
% Use \setkeys{Gin} if you need to change an image's display size
\setkeys{Gin}{width=.5\linewidth}
![exampleimage](example-image.jpg "An exemplary image")
## Tables
| index | Name |
|-----|-----|
| 1 | Foo |
| 2 | Bar |
| 3 | Baz |
: \textsc{php}Markdown-style table
## Equations
Inline math equations go in like so: $\omega = d\phi / dt$.
Displaymath can be written as:
\begin{equation}
I = \int \rho R^{2} \mathop{}\!\mathrm{d}V
\end{equation}
You can backslash-escape any punctuation characters
which you wish to be displayed literally, ex.: \`foo\`, \*bar\*, etc.
\documentclass{article}
\usepackage{graphicx}
\usepackage{minted}
\setminted{fontsize=\small, autogobble=true, breaklines}
\setminted[tex]{breaksymbolleft={}}
\usepackage{hyperref}
\usepackage{markdown}
\markdownSetup{
renderers = {
link = {\href{#2}{#1}}, % Render a link as href.
emphasis = {\emph{#1}}, % Render emphasis using `\emph`.
},
hybrid = true,
smartEllipses = true,
fencedCode = true,
inlineFootnotes = true,
pipeTables=true,
tableCaptions=true,
}
\begin{document}
\markdownInput{./example.md}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment