Last active
December 28, 2021 02:13
-
-
Save jdhao/90fcc239cfa3bba77e10185580e16170 to your computer and use it in GitHub Desktop.
This is a Sublime Text build system which converts Markdown file to PDF using Pandoc and supports both English and Chinese. Features are: numbered section; url color; highlighted inline code and code blocks; build and preview using Sumatra pdf reader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\usepackage{fancyvrb,newverbs} | |
% set up page geometry | |
\usepackage[top=2cm, bottom=1.5cm, left=2cm, right=2cm]{geometry} | |
% change background color for inline code in | |
% markdown files. The following code does not work well for | |
% long text as the text will exceed the page boundary | |
\definecolor{bgcolor}{HTML}{DADADA} | |
\let\oldtexttt\texttt | |
\renewcommand{\texttt}[1]{ | |
\colorbox{bgcolor}{\oldtexttt{#1}} | |
} | |
%% color and other settings for the hyperref package | |
\hypersetup{ | |
bookmarksopen=true, | |
linkcolor=blue, | |
filecolor=magenta, | |
urlcolor=NavyBlue, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"shell_cmd": "pandoc -f markdown-raw_tex --pdf-engine=xelatex -N --highlight-style=espresso -H \"${packages}\"/User/head.tex -V CJKmainfont=\"Noto Sans CJK SC\" -V colorlinks \"${file}\" -o \"${file_path}/${file_base_name}.pdf\" ", | |
"path": "C:/Users/east/AppData/Local/Pandoc/;%PATH%", | |
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", | |
"working_dir": "${file_path}", | |
"selector": "text.html.markdown", | |
"variants": | |
[ | |
{ | |
"name": "Build and View", | |
"shell_cmd": "pandoc -f markdown-raw_tex --pdf-engine=xelatex -N --highlight-style=espresso -H \"${packages}\"/User/head.tex -V CJKmainfont=\"Noto Sans CJK SC\" -V colorlinks \"${file}\" -o \"${file_path}/${file_base_name}.pdf\" && SumatraPDF \"${file_path}/${file_base_name}.pdf\" ", | |
"path": "C:/Users/east/AppData/Local/Pandoc/;%PATH%", | |
// "shell_cmd": "start \"$file_base_name\" call $file_base_name" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
head.tex
file should be put under directoryC:\Users\Administrator\AppData\Roaming\Sublime Text 3\Packages\User
on Windows system. A more robust way to find the package directory is usesublime.packages_path()
command in the Sublime Text console.