Skip to content

Instantly share code, notes, and snippets.

@pvrego
Last active March 30, 2022 20:31
Show Gist options
  • Save pvrego/f3d870ee3ae59e845d8049383a24cd34 to your computer and use it in GitHub Desktop.
Save pvrego/f3d870ee3ae59e845d8049383a24cd34 to your computer and use it in GitHub Desktop.
Markdown To LaTeX
% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{article}
\usepackage{amsmath,amssymb}
\usepackage{lmodern}
\usepackage{iftex}
\ifPDFTeX
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
\usepackage{unicode-math}
\defaultfontfeatures{Scale=MatchLowercase}
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
\usepackage[]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
\KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\hypersetup{
pdftitle={Using Alchemy},
pdfkeywords={docs, matic},
hidelinks,
pdfcreator={LaTeX via pandoc}}
\urlstyle{same} % disable monospaced font for URLs
\usepackage[margin=2cm]{geometry}
\usepackage{color}
\usepackage{fancyvrb}
\newcommand{\VerbBar}{|}
\newcommand{\VERB}{\Verb[commandchars=\\\{\}]}
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
% Add ',fontsize=\small' for more characters per line
\usepackage{framed}
\definecolor{shadecolor}{RGB}{42,33,28}
\newenvironment{Shaded}{\begin{snugshade}}{\end{snugshade}}
\newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,1.00,0.00}{#1}}
\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.00,0.40,1.00}{\textbf{\textit{#1}}}}
\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.74,0.68,0.62}{#1}}
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.27,0.67,0.26}{#1}}
\newcommand{\BuiltInTok}[1]{\textcolor[rgb]{0.74,0.68,0.62}{#1}}
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.02,0.61,0.04}{#1}}
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.00,0.40,1.00}{\textbf{\textit{#1}}}}
\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.74,0.68,0.62}{#1}}
\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.74,0.68,0.62}{#1}}
\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.26,0.66,0.93}{\textbf{#1}}}
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.74,0.68,0.62}{\underline{#1}}}
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.27,0.67,0.26}{#1}}
\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.00,0.40,1.00}{\textit{#1}}}
\newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,1.00,0.00}{\textbf{#1}}}
\newcommand{\ExtensionTok}[1]{\textcolor[rgb]{0.74,0.68,0.62}{#1}}
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.27,0.67,0.26}{#1}}
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{1.00,0.58,0.35}{\textbf{#1}}}
\newcommand{\ImportTok}[1]{\textcolor[rgb]{0.74,0.68,0.62}{#1}}
\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.00,0.40,1.00}{\textbf{\textit{#1}}}}
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.26,0.66,0.93}{\textbf{#1}}}
\newcommand{\NormalTok}[1]{\textcolor[rgb]{0.74,0.68,0.62}{#1}}
\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.74,0.68,0.62}{#1}}
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.74,0.68,0.62}{#1}}
\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.74,0.68,0.62}{\textbf{#1}}}
\newcommand{\RegionMarkerTok}[1]{\textcolor[rgb]{0.74,0.68,0.62}{#1}}
\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.02,0.61,0.04}{#1}}
\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.02,0.61,0.04}{#1}}
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.02,0.61,0.04}{#1}}
\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.74,0.68,0.62}{#1}}
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.02,0.61,0.04}{#1}}
\newcommand{\WarningTok}[1]{\textcolor[rgb]{1.00,1.00,0.00}{\textbf{#1}}}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\ifLuaTeX
\usepackage{selnolig} % disable illegal ligatures
\fi
\title{Using Alchemy}
\author{}
\date{}
\begin{document}
\maketitle
\input{develop\alchemy}
\end{document}
@echo off

set BASEFOLDER=%1%
set TARGET=%2%
if not exist %BASEFOLDER%\%2% (
	echo Folder %BASEFOLDER%\%2% does not exist
	exit 0
)
set LOGFILENAME=%3%

set OPTIONS1=--variable=geometry:"margin=2cm"
set OPTIONS2=--standalone

set RUNCMD=pandoc --from=markdown --to=latex %%f --output=%TARGET%\%%~nf.tex --highlight-style=espresso %OPTIONS1% %OPTIONS2%

if not exist %TARGET% (mkdir %TARGET%)
for %%f in (%BASEFOLDER%\%TARGET%\*.*) do (
	%RUNCMD%
	echo %%~nf.tex
	echo %%~nf.tex >> %LOGFILENAME%
)
exit 0
@echo off

set BASEFOLDER=C:\Users\user\Documents\project_foldername
set LOGFILENAME=%~n0.info
echo ===== Project Structure for %LOGFILENAME% ===== > %LOGFILENAME%

for /d %%f in (%BASEFOLDER%\*.*) do if not [%%~nf]==[] (
	echo ==== Resolving 1st-level folder : %%~nf
	echo ==== 1st-level folder : %%~nf >> %LOGFILENAME%
	
	cmd /c convert_md2tex.bat %BASEFOLDER% %%~nf %LOGFILENAME%
	
	for /d %%g in (%BASEFOLDER%\%%~nf\*) do (
		echo == Resolving 2nd-level folder : %%~nf\%%~ng
		echo == 2nd-level folder : %%~nf\%%~ng >> %LOGFILENAME%
		
		if not exist %%~nf (mkdir %%~nf)
		cd %%~nf
		cmd /c ..\convert_md2tex.bat %BASEFOLDER%\%%~nf %%~ng ..\%LOGFILENAME%
		cd ..
	)
)
@echo off

set BASEFOLDER=C:\Users\user\Documents\converingtotex\Polygon-Docs
set LOGFILENAME=%~n0.info
echo ===== Project Structure for %LOGFILENAME% ===== > %LOGFILENAME%

for /d %%f in (%BASEFOLDER%\*.*) do if not [%%~nf]==[] (
	echo ==== Resolving 1st-level folder : %%~nf
	echo ==== 1st-level folder : %%~nf >> %LOGFILENAME%
	
	cmd /c convert_md2tex.bat %BASEFOLDER% %%~nf %LOGFILENAME%
	
	for /d %%g in (%BASEFOLDER%\%%~nf\*) do (
		echo == Resolving 2nd-level folder : %%~nf\%%~ng
		echo == 2nd-level folder : %%~nf\%%~ng >> %LOGFILENAME%
		
		if not exist %%~nf (mkdir %%~nf)
		cd %%~nf
		cmd /c ..\convert_md2tex.bat %BASEFOLDER%\%%~nf %%~ng ..\%LOGFILENAME%

		for /d %%h in (%BASEFOLDER%\%%~nf\%%~ng\*) do (
			echo == Resolving 3nd-level folder : %%~nf\%%~ng\%%~nh
			echo == 3nd-level folder : %%~nf\%%~ng\%%~nh >> ..\%LOGFILENAME%
			
			if not exist %%~ng (mkdir %%~ng)
			cd %%~ng
			cmd /c ..\..\convert_md2tex.bat %BASEFOLDER%\%%~nf\%%~ng %%~nh ..\..\%LOGFILENAME%
			cd ..		
		)

		cd ..
	)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment