Slides with Columns in Pandoc

Current versions of pandoc (i.e., pandoc 2.0 and later) supports fenced divs. Specially named divs are transformed into columns when targeting a slides format: # This slide has columns ::: columns :::: column left :::: :::: column right :::: ::: Pandoc translates this into the following LaTeX beamer code: \begin{frame}{This slide has columns} \protect\hypertarget{this-slide-has-columns}{} \begin{columns}[T] … Read more

Bold font weight for LaTeX axes label in matplotlib

Unfortunately you can’t bold symbols using the bold font, see this question on tex.stackexchange. As the answer suggests, you could use \boldsymbol to bold phi: r’$\boldsymbol{\phi}$’ You’ll need to load amsmath into the TeX preamble: matplotlib.rc(‘text’, usetex=True) matplotlib.rcParams[‘text.latex.preamble’]=[r”\usepackage{amsmath}”]

Converting latex code to Images (or other displayble format) with Python

SymPy has a builtin preview function that does this. expr = sin(sqrt(x**2 + 20)) + 1 preview(expr, viewer=”file”, filename=”output.png”) generates There are lots of options to preview to change the format of the output (for instance, if you don’t like the Euler font you can set euler=False). preview also accepts a LaTeX string instead of … Read more

Latex rendering in README.md on Github

For short expresions and not so fancy math you could use the inline HTML to get your latex rendered math on codecogs and then embed the resulting image. Here an example: – <img src=”https://latex.codecogs.com/gif.latex?O_t=\text { Onset event at time bin } t ” /> – <img src=”https://latex.codecogs.com/gif.latex?s=\text { sensor reading } ” /> – <img … Read more

How to write your own LaTeX preamble in Matplotlib?

When I need to use LaTeX with matplotlib, I add the following to the python script (+ additional commands for debug info) import matplotlib.pyplot as plt plt.rc(‘text’, usetex=True) plt.rc(‘text.latex’, preamble=r’\usepackage{amsmath} \usepackage{foo-name} `…’) matplotlib.verbose.level=”debug-annoying” commands to make your plot here

LaTeX fraction snippets in VSCode

After you install HyperSnips, use its command HyperSnips: Open snippets directory to open the directory where you will put your snippets. Snippets in all.hsnips will be available in all language files. You can also put your snippets into something like latex.hsnips or Latex.hsnips in the same directory and both versions work for me. Modifying the … Read more