Skip to content

Instantly share code, notes, and snippets.

@asaurabh-iitk
asaurabh-iitk / fwatcher.ps1
Created May 13, 2025 04:07
Windows FileWatcher
$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = '<foldername>'
$watcher.Filter="*.md"
$watcher.EnableRaisingEvents = $true
$action = {c:\apps\pandoc-3.6\pandoc.exe --lua-filter=include-files.lua --standalone --template eisvogel --citeproc --listings -o output.pdf main.md
Write-Host "Files changed"}
Register-ObjectEvent $watcher 'Changed' -Action $action
$watcher.EnableRaisingEvents = $false
Get-EventSubscriber | Unregister-Event
@asaurabh-iitk
asaurabh-iitk / mdcitationconvert.md
Created August 6, 2024 11:34
Citations in md for future conversion to latex

There is no built-in feature in pandoc that compiles pandoc-style citations to the cite package format.

A quick workaround would be to first use the --natbib flag in pandoc to convert to natbib:

pandoc article.md -s --natbib -o article.tex

then use the following sed commands to rename all the citations from \citet and \citep to \cite as well as change the natbib package in the preamble to cite:

@asaurabh-iitk
asaurabh-iitk / maths.tex
Created February 19, 2024 10:17
standalone latex document for equations
\documentclass[convert, border=1pt]{standalone}
\usepackage{newtxtext,newtxmath,amsmath,amsfonts}
\usepackage[T1]{fontenc}
\begin{document}
$\begin{aligned}
\frac{p_0}{p}=\left(1+\frac{\gamma-1}{2}M^2\right)^{\frac{\gamma}{\gamma-1}}\\
\end{aligned}$
\end{document}
@asaurabh-iitk
asaurabh-iitk / mkdocs-math.yml
Created January 26, 2023 18:23
use with pip install pymdown-extensions
# mkdocs.yml file
# other settings ...
markdown_extensions:
# other extensions ...
- pymdownx.arithmatex
# other settings ...
@asaurabh-iitk
asaurabh-iitk / mathjax-config.js
Created January 26, 2023 18:22
config file to be kept within docs folder
/* mathjax-loader.js file */
/* ref: http://facelessuser.github.io/pymdown-extensions/extensions/arithmatex/ */
(function (win, doc) {
win.MathJax = {
config: ["MMLorHTML.js"],
extensions: ["tex2jax.js"],
jax: ["input/TeX"],
tex2jax: {
inlineMath: [ ["\\(","\\)"] ],
displayMath: [ ["\\[","\\]"] ]
@asaurabh-iitk
asaurabh-iitk / mdeqns.md
Created January 26, 2023 18:20
using labels for equations in md documents

$$ \begin{align} \label{eq:pythagoras} x^2 + y^2 = z^2 \end{align} $$

As we can see from $\eqref{eq:pythagoras}$ all is well in Denmark.