The combination of Markdown and LaTex Math is the best way. Comparison with latex documents Although the whole document of many mathematics academic papers is directly edited with latex syntax just like markdown, after careful comparison, it is found that the effect of writing the whole document directly with latex syntax is not much different. Tl;dr If you want to write documents in Markdown, embed LaTeX, and generate PDFs, use Pandoc. Skip down to Kung Fu Pandoc to get started! So just use LaTeX, they said. It'll be fun, they said. Markdown math is the basic usage of latex grammar output mathematical formula. We will introduce it here first, and then we will study it when we contact it in the learning process. Cross platform display of markdown math. LaTeX mathematical expressions StackEdit renders mathematics from LaTeX expressions inside your markdown file, as you would do on Stack Exchange. R Markdown is one of the document formats that knitr supports, and it is probably the most popular one. I have been asked many times about the choice between Markdown and LaTeX, so I think I’d better wrap up my opinions in a blog post.
Markdown can be included in LaTeX documents by means of the markdown package. To use this, simply include usepackage{markdown}
in the preamble of your document.
- 3Markdown package features and options
Below, we have provided an example markdown file called example.md
.
To include this external markdown file in your LaTeX document, use the markdownInput{...}
command as shown below:
Similarly to including an external markdown file, the markdown
package also provides you with a way of including inline markdown in your document. This is done with the markdown
environment as shown below:
The markdown package provides many other features and options. We will mention a few of them here.
Including code in markdown
To include code snippets in markdown, we simply indent with 4 spaces as shown below:
Alternatively with markdown v2.4, we can achieve the same result using fenced code. To do this, bound your code inside ~
~
~
~
...
~
~
~
~
. You will also need to include the fencedCode
option in your preamble as shown below:
Lists
We have already seen how unordered lists can be included in markdown using *
. Similarly with the hashEnumerators
option, ordered lists can be written with #
. It is also possible to create nested lists as shown below:
Hyperlinks and footnotes
You can include hyperlinks to external sites using markdown by writing [link text](http://www.foo.bar)
, and now with markdown v2.4, it is possible to include inline footnotes with by using the inlineFootnotes
option as shown below.
Images and Referencing
Images can be included in markdown by writing ![imagelabel](example-image.jpg 'Image Title')
.
In LaTeX, to reference a an image included in markdown with the label imagelabel
, we have to add fig:
as a prefix to the label i.e. ref{fig:imagelabel}
. An example of this is shown below:
Including LaTeX inside markdown
If you enable the hybrid
option, You can mix LaTeX code in Markdown!
Overleaf guides
LaTeX Basics
Mathematics
Figures and tables
References and Citations
Languages
Document structure
Formatting
Fonts
Presentations
Commands
Markdown Latex Cheat Sheet
Field specific
Class files
Advanced TeX/LaTeX
You can view my public demo for this post here
Recently, I have been on a bit of a mission to improve my school workflow with software. Over the past month, I have built a cleaner student portal for my school and written a tool for automating in-class attendance. Alongside working on these projects, I have also been refining my notetaking system for school.
Since 9th grade, I have been taking notes in a private GitHub repository in markdown, and have been compiling them to HTML using a makefile for each course. While this system has worked ok, It has been far from perfect. Recently, I have been working very hard to give this system a much-needed upgrade. Here is the new tech stack:
- The Bazel buildsystem
- Github Actions CI
Jupyter Notebook Markdown Latex
The idea is that every course I take becomes its own Bazel package, with subpackages for things like assignments, papers, notes, and presentations. I can compile everything just by running the command bazel build //:all
. All builds are cached using Bazel’s build caching system, so when I run the command to compile my notes (I love saying that), I only end up compiling things that have changed since the last run. The setup for all of this is quite simple. All that is really needed is a Bazel workspace with the bazel_pandoc
rules loaded (although I have opted to use some custom genrules instead). Using these rules, markdown files can be concatenated, and compiled into a PDF. I also use a modified version of the Eisvogel Pandoc template to make all my documents look a little neater.
In terms of workflow, I write all my notes as markdown files with embedded LaTeX for any equations and charts I may need. All of this is done inside of VSCode, and I have a custom tasks.json
file that lets me press Ctrl + Shift + b to re-compile whatever I am currently working on. I also keep Zathura open in a window to the side for a nearly-live preview system.
A screenshot of my workspace
Now, the question came up of “how do you easily distribute notes and assignments to classmates and professors?”. That question got me stuck for a while, but here is the system I have come up with:
- I write an assignment
- I push it to the private GitHub repository
- GitHub Actions picks up the deployment with a custom build script
- Every document is built into a PDF, and packaged with a directory listing generated by
tree -H
- Everything is pushed to a subdomain on my website via GitHub pages
- I can share documents via URL to anyone
Markdown Latex Equation
This is almost entirely accomplished by a shell script and a custom CI script.
If you have any questions about this system, want me to write another post about it, or would like me to walk you through setting up a notes workspace of your own, contact me
Thank you for reading this post. If you enjoyed the content, and want to let me know, or want to ask any questions, please contact me via one of the methods listed here. If you would like to be notified about future posts, feel free to load my rss feed into your favorite feed reader, or follow me on Twitter for notifications about my work and future posts.
If you have the time to read some more, I recommend checking out one of the following posts: