md2pdf

pandoc wrapper for converting markdown to pdf
Index Commits Files Refs README
commit 986102dbd939e7848fdc449d002ee4d20524b202
parent 95bcc25e2e894f39dd93906c7364cf2fb6868635
Author: Martin Kloeckner <mjkloeckner@gmail.com>
Date:   Thu, 25 Sep 2025 11:08:24 -0300

added `twocolumn` option

Diffstat:
Mmd2pdf | 44+++++++++++++++++++++++++++++---------------
1 file changed, 29 insertions(+), 15 deletions(-)
diff --git a/md2pdf b/md2pdf
@@ -1,16 +1,19 @@
 #!/bin/sh
 
 usage() {
-    printf "$(basename $0) [OPTIONS] <input>.md\n"
-    printf "OPTIONS:\n"
-    printf "  -H, --style <file>.tex\n"
-    printf "  -l, --lua-filter <file>.lua\n"
+    printf "$(basename $0) [OPTIONS] <input>.md\n"
+    printf "OPTIONS:\n"
+    printf "  -H, --style <file>.tex\n"
+    printf "  -l, --lua-filter <file>.lua\n"
     printf "  -o, --output <file>\n"
+    printf " -tc, --two-column\n"
 }
 
 md2pdf_path=$(dirname $(readlink -f $0))
 style_path=$md2pdf_path"/style.tex"
 highlight_style_path="$md2pdf_path/tango-grey-bg.theme"
+# highlight_style_path="$HOME/.local/bin/pygments.theme"
+cmd=""
 
 while [ $# -gt 1 ]; do
     case "$1" in
@@ -22,6 +25,7 @@ while [ $# -gt 1 ]; do
         --lua-filter|-l)
             shift
             lua_filter_path="$(readlink -f "$1")"
+            cmd="$cmd --lua-filter $lua_filter_path"
             shift
             ;;
         --output|-o)
@@ -29,6 +33,10 @@ while [ $# -gt 1 ]; do
             output="$1"
             shift
             ;;
+        --two-column|-tc)
+            shift
+            cmd="$cmd -V classoption=twocolumn"
+            ;;
         *)
             shift
             ;;
@@ -46,25 +54,31 @@ echo "* style file: \`$(realpath --relative-to=$HOME $style_path)\`"
     lua_filter="--lua-filter=$lua_filter_path"
 echo "* highlight style file: \`$(realpath --relative-to=$HOME $highlight_style_path)\`"
 
+# lua_fiter=$HOME/dox/sync/sync/md2pdf/tables-rules.lua
+# --lua-filter $lua_fiter \
 [ -z "$output" ] && output="$filename.pdf"
 input_format="markdown+startnum+tex_math_dollars+implicit_figures"\
 "+grid_tables+backtick_code_blocks"
 
 [ "$extension" != "md" ] && \
-    echo "Input file not markdown" && \
-    usage && exit 2
+    echo "Input file not markdown" && \
+    usage && exit 2
 
+# -V fontsize:12pt \
+# --listings \
 pandoc --pdf-engine=xelatex \
-    -V colorlinks=true \
-    -V linkcolor=blue \
-    -V urlcolor=blue \
-    -H $style_path \
-    -f $input_format \
-    --highlight-style "$highlight_style_path" \
-    --shift-heading-level-by=-1 \
-    -o "$output" \
+    -V colorlinks=false \
+    -V linkcolor=black \
+    -V urlcolor=blue \
+    -V tables=false \
+    $cmd \
+    -H $style_path \
+    -f $input_format+implicit_figures+raw_tex \
+    --highlight-style "$highlight_style_path" \
+    --shift-heading-level-by=-1 \
+    -o "$output" \
     $lua_filter \
-    "$filename".md
+    "$filename".md
 
 [ $? -ne 0 ] && exit 3