教程在网上一搜就有不过有些已经陈旧了.先做出以下修改
1. 下载pandoc

$ sudo apt-get install pandoc 
  1. 下载xelatex引擎
$ sudo apt-get install texlive-xetex texlive-latex-recommended texlive-latex-extra 
  1. 配置字体模板
\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$]{$documentclass$}
\usepackage{geometry}       % 設定邊界
\geometry{top=1in,inner=1in,outer=1in,bottom=1in,headheight=3ex,headsep=2ex
}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex\usepackage[utf8]{inputenc}
$if(euro)$\usepackage{eurosym}
$endif$
\else % if luatex or xelatex\usepackage{fontspec}     % 允許設定字體\usepackage{xeCJK}        % 分開設置中英文字型\setCJKmainfont{WenQuanYi Micro Hei}  % 設定中文字型\setmainfont{Ubuntu}  % 設定英文字型\setromanfont{Ubuntu}     % 字型\setmonofont{Ubuntu}\linespread{1.2}\selectfont   % 行距\XeTeXlinebreaklocale "zh"    % 針對中文自動換行\XeTeXlinebreakskip = 0pt plus 1pt % 字與字之間加入0pt至1pt的間距,確保左右對整齊\parindent 0em        % 段落縮進\setlength{\parskip}{20pt}    % 段落之間的距離\ifxetex\usepackage{xltxtra,xunicode}\fi\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}\newcommand{\euro}{€}
$if(mainfont)$\setmainfont{$mainfont$}
$endif$
$if(sansfont)$\setsansfont{$sansfont$}
$endif$
$if(monofont)$\setmonofont{$monofont$}
$endif$
$if(mathfont)$\setmathfont{$mathfont$}
$endif$
\fi
% use microtype if available
\IfFileExists{microtype.sty}{\usepackage{microtype}}{}
$if(geometry)$
\usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
$endif$
$if(natbib)$
\usepackage{natbib}
\bibliographystyle{plainnat}
$endif$
$if(biblatex)$
\usepackage{biblatex}
$if(biblio-files)$
\bibliography{$biblio-files$}
$endif$
$endif$
$if(listings)$
\usepackage{listings}
$endif$
$if(lhs)$
\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
$endif$
$if(highlighting-macros)$
$highlighting-macros$
$endif$
$if(verbatim-in-note)$
\usepackage{fancyvrb}
$endif$
$if(tables)$
\usepackage{longtable}
$endif$
$if(graphics)$
\usepackage{graphicx}
% We will generate all images so they have a width \maxwidth. This means
% that they will get their normal width if they fit onto the page, but
% are scaled down if they would overflow the margins.
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth
\else\Gin@nat@width\fi}
\makeatother
\let\Oldincludegraphics\includegraphics
\renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=\maxwidth]{#1}}
$endif$
\ifxetex\usepackage[setpagesize=false, % page size defined by xetexunicode=false, % unicode breaks when used with xetexxetex]{hyperref}
\else\usepackage[unicode=true]{hyperref}
\fi
\hypersetup{breaklinks=true,bookmarks=true,pdfauthor={$author-meta$},pdftitle={$title-meta$},colorlinks=true,urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$,linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$,pdfborder={0 0 0}}
\urlstyle{same}  % don't use monospace font for urls
$if(links-as-notes)$
% Make links footnotes instead of hotlinks:
\renewcommand{\href}[2]{#2\footnote{\url{#1}}}
$endif$
$if(strikeout)$
\usepackage[normalem]{ulem}
% avoid problems with \sout in headers with hyperref:
\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
$endif$
\setlength{\parindent}{0pt}
%\setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em}  % prevent overfull lines\title{\huge 在OSX平台上的XeLaTeX中文測試} % 設置標題,使用巨大字體
\author{FoolEgg.com}        % 設置作者
\date{February 2013}        % 設置日期
\newcommand{\tightlist}{%\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
%\usepackage{titling}
%\setlength{\droptitle}{-8em}   % 將標題移動至頁面的上面\usepackage{fancyhdr}
\usepackage{lastpage}
\pagestyle{fancyplain}$if(numbersections)$
\setcounter{secnumdepth}{5}
$else$
\setcounter{secnumdepth}{0}
$endif$
$if(verbatim-in-note)$
\VerbatimFootnotes % allows verbatim text in footnotes
$endif$
$if(lang)$
\ifxetex\usepackage{polyglossia}\setmainlanguage{$mainlang$}
\else\usepackage[$lang$]{babel}
\fi
$endif$
$for(header-includes)$
$header-includes$
$endfor$$if(title)$
\title{$title$}
$endif$
\author{$for(author)$$author$$sep$ \and $endfor$}
\date{$date$}\begin{document}
$if(title)$
\maketitle
$endif$$for(include-before)$
$include-before$$endfor$
$if(toc)$
{\hypersetup{linkcolor=black}
\setcounter{tocdepth}{$toc-depth$}
\tableofcontents
}
$endif$
$body$$if(natbib)$
$if(biblio-files)$
$if(biblio-title)$
$if(book-class)$
\renewcommand\bibname{$biblio-title$}
$else$
\renewcommand\refname{$biblio-title$}
$endif$
$endif$
\bibliography{$biblio-files$}$endif$
$endif$
$if(biblatex)$
\printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$$endif$
$for(include-after)$
$include-after$$endfor$
\end{document}
  1. 傻瓜化操作
pandoc *.md --latex-engine=xelatex --template=pandoc.template -o *.pdf

pandoc md 文件转化pdf(中文字体)相关推荐

  1. linux打开word乱码,解决linux下openoffice word文件转PDF中文乱码的问题

    网上很多介绍是由于jdk中的没有字体导致乱码,而我遇到的是转换过程并未报错,但转换后的PDF中是乱码,尝试在jre/lib/fonts/中增加字体,还是不能解决问题,因此可以判断非jre字体问题,是l ...

  2. vscode将md文件转pdf

    vscode将md文件转pdf 工具 方法 效果 图片测试 工具 vscode 插件:Markdown Preview Enhanced chrome 方法 找到谷歌的安装路径(我的安装路径为:C:\ ...

  3. iText生成pdf中文字体

    用iText生成pdf时,内容有中文的时候用到中文字体. 直接使用iTextAsian.jar中的字体 BaseFont base = BaseFont.createFont("STSong ...

  4. .md文件转.pdf文件

    一.安装VS code vscode是一个轻量级的.可扩展性十分强的开发编辑器.过程略,比较简单. 二.安装插件Markdown PDF 直接 install 就可以了. 我这里出现了安装失败的情景, ...

  5. 如何将.md文件转换为pdf

    目录 1.step1: 安装Visual Studio Code(简称VScode) 2.step2: 安装定制化插件 3.step3: 进入预览窗口模式 4.step4: 进行格式转换 1.step ...

  6. Office文件转化PDF实现预览功能

    OpenOffice文件转PDF 实测有用 OpenOffice办公文件预览功能 OpenOffice操作 aspose-words来实现预览 预览操作 OpenOffice办公文件预览功能 Hell ...

  7. 把md文件转换为pdf文件

    1.在谷歌浏览器中安装Markdown Preview Plus插件. 2.选择更多工具,扩展程序 3.点击安装的插件的详细信息 4.然后允许访问文件网址 5.直接把要转换的md文件拖入到浏览器窗口中 ...

  8. 关于在pdf文件中的中文字体显示

    宋体 (TrueType) = SIMSUN.TTF 黑体 (TrueType) = simhei.ttf 楷体_GB2312 (TrueType) = simkai.ttf 仿宋_GB2312 (T ...

  9. itext html 转换 pdf文件,利用itext将html文件转化pdf文件(5)——多个文件的合并

    工作中经常会遇到将多个html文件转化为pdf,并且将pdf转化之后的文件进行合并.官方参考文档 下面来介绍简单的操作:import java.io.ByteArrayInputStream; imp ...

  10. OpenOffice+JodConverter实现Office文件到PDF的转换

    文章目录 1. OpenOffice 下载.安装.启动 2. JodConverter下载 3. 文件转化 4. 中文乱码 5. 解决中文乱码 1. OpenOffice 下载.安装.启动 openo ...

最新文章

  1. 智课雅思词汇---五、优词词根字典
  2. python处理rgb_如何在Python中读取给定像素的RGB值?
  3. python import random 报错_Python import random报错处理办法
  4. Windows下CodeBlocks安装及配置注意事项
  5. can't select mysql database_ERROR 1006 (HY000) Can't create database (errno: 13) MySQL 5.6.12
  6. mui刷新不显示动画_144Hz刷新率和60Hz有啥区别?体验有何不同?这里全告诉你
  7. python字典用法_科学网—Python:字典和字典方法 - 刘洋洋的博文
  8. vs2017如何编程python_vs2017怎么编写python代码
  9. java cjson_使用cJSON
  10. 卡巴斯基7.0最新激活码
  11. Allegro导出dxf
  12. ui文件转换为py文件方法
  13. 关于USB CCID 协议的一些英文缩写
  14. linux去除文件中重复行,Linux Shell教程 - 如何删除重复的文本行
  15. 常见的协议的协议号及端口
  16. 《Adobe Illustrator CS6中文版经典教程(彩色版)》—第0课0.15节使用“外观”面板与效果...
  17. lumia 830 android,微软Lumia 830成功刷入Android 5.0系统
  18. matlab将surfer格式转化矩阵,matlab调用surfer
  19. dvcs-ripper的安装使用
  20. python爬虫个人学习笔记

热门文章

  1. Zbar源码解析——zbar_oho_条形码阅读器|2021SC@SDUSC
  2. c语言.jpg图片转成数组_图片可以转Word吗?教你两种方法轻松转换
  3. 基于Android的天气预报APP设计与实现
  4. 2021/08/09模拟赛总结
  5. arcgis 属性表 汇总_最常用的GIS数据汇总
  6. CSP 201809-1 卖菜
  7. es6 混合commjs_ES6 模块化的时代真的来临了么?Using MJS
  8. 编程难?零基础如何学好编程?
  9. 读论文Beyond Part Models Person Retrieval with Refined Part Pooling
  10. 3d渲染性能测试软件,3D渲染性能测试