https://en.wikibooks.org/wiki/LaTeX/Source_Code_Listings
Using the package listings you can add non-formatted text as you would do with \begin{verbatim} but its main aim is to include the source code of any programming language within your document. If you wish to include pseudocode or algorithms, you may find Algorithms and Pseudocode useful also.
showspaces=false, % show spaces everywhere adding particular underscores; it overrides 'showstringspaces'
showstringspaces=false, % underline spaces within strings only
minted is an alternative to listings which has become popular. It uses the external Python library Pygments for code highlighting, which as of Nov 2014 boasts over 300 supported languages and text formats.
Bugs 处理记录
字体中单双引号显示问题
原英文 latex 模板中使用的字体本身问题,现在切换为默认字体来显示英文
Improper alphabetic constant 字体问题, -V CJKmainfont="${MAINFONT}" \ -V mainfont="${MAINFONT}" \ -V sansfont="${MAINFONT}" \ -V monofont="${MONOFONT}" \ CJKbookmarks
【解决方案】 第一,就是模板并不支持中文显示,需要CJK 或者xetex xeCJK等等来对中文支持做一些额外工作。以CJK为例: 必须先引入一个 CJK 环境: \begin{CJK}{GBK}{song} 中文 \end{CJK} 第二,就是中文字体配置是否正确,比如CJK所指定的编码和文件编码是否一致。通常是这两种情况。 第三,若是排除了上面的情况,在一个就是在做slides幻灯的时候经常遇到,主要是hyperref引起的错误。 需要加上\hypersetup{CJKbookmarks=true}这样的一个选项即可。
code block中的空格
https://en.wikibooks.org/wiki/LaTeX/Source_Code_Listings Using the package listings you can add non-formatted text as you would do with \begin{verbatim} but its main aim is to include the source code of any programming language within your document. If you wish to include pseudocode or algorithms, you may find Algorithms and Pseudocode useful also.
showspaces=false, % show spaces everywhere adding particular underscores; it overrides 'showstringspaces' showstringspaces=false, % underline spaces within strings only
minted is an alternative to listings which has become popular. It uses the external Python library Pygments for code highlighting, which as of Nov 2014 boasts over 300 supported languages and text formats.
https://en.wikibooks.org/wiki/LaTeX/Colors gray color
table 宽度问题:
markdown_github format 和 更新的 gfm(目前镜像中的版本不支持)
未解决的问题
table overlaps page number
longtable macro 的bug,https://github.com/jgm/pandoc/issues/2889 需要打patch的longtable,https://www.latex-project.org/cgi-bin/ltxbugs2html.new?pr=tools/3512 较为麻烦暂时不处理...
代码块字符串本身的换行问题
breaklines=true,无法指定,没看到解决办法 后续可能切换到 minted 处理