<bdo id='XKNir'></bdo><ul id='XKNir'></ul>
  • <legend id='XKNir'><style id='XKNir'><dir id='XKNir'><q id='XKNir'></q></dir></style></legend>
    1. <tfoot id='XKNir'></tfoot>
      <i id='XKNir'><tr id='XKNir'><dt id='XKNir'><q id='XKNir'><span id='XKNir'><b id='XKNir'><form id='XKNir'><ins id='XKNir'></ins><ul id='XKNir'></ul><sub id='XKNir'></sub></form><legend id='XKNir'></legend><bdo id='XKNir'><pre id='XKNir'><center id='XKNir'></center></pre></bdo></b><th id='XKNir'></th></span></q></dt></tr></i><div id='XKNir'><tfoot id='XKNir'></tfoot><dl id='XKNir'><fieldset id='XKNir'></fieldset></dl></div>

      <small id='XKNir'></small><noframes id='XKNir'>

      1. PDF中的Pandoc语法突出显示不起作用

        时间:2023-10-18
        • <bdo id='8bWI9'></bdo><ul id='8bWI9'></ul>

            • <tfoot id='8bWI9'></tfoot>

                <tbody id='8bWI9'></tbody>
              <i id='8bWI9'><tr id='8bWI9'><dt id='8bWI9'><q id='8bWI9'><span id='8bWI9'><b id='8bWI9'><form id='8bWI9'><ins id='8bWI9'></ins><ul id='8bWI9'></ul><sub id='8bWI9'></sub></form><legend id='8bWI9'></legend><bdo id='8bWI9'><pre id='8bWI9'><center id='8bWI9'></center></pre></bdo></b><th id='8bWI9'></th></span></q></dt></tr></i><div id='8bWI9'><tfoot id='8bWI9'></tfoot><dl id='8bWI9'><fieldset id='8bWI9'></fieldset></dl></div>

                <small id='8bWI9'></small><noframes id='8bWI9'>

                <legend id='8bWI9'><style id='8bWI9'><dir id='8bWI9'><q id='8bWI9'></q></dir></style></legend>
                1. 本文介绍了PDF中的Pandoc语法突出显示不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  pandoc --version 产生:

                  pandoc 1.12.2.1
                  Compiled with texmath 0.6.5.2, highlighting-kate 0.5.5.1.
                  Syntax highlighting is supported for the following languages:
                      actionscript, ada, apache, asn1, asp, awk, bash, bibtex, boo, c, changelog, clojure, cmake, coffee, coldfusion, commonlisp, cpp, cs, css, curry, d, diff, djangotemplate, doxygen, doxygenlua, dtd, eiffel, email, erlang, fortran, fsharp, gnuassembler, go, haskell, haxe, html, ini, java, javadoc, javascript, json, jsp, julia, latex, lex, literatecurry, literatehaskell, lua, makefile, mandoc, markdown, matlab, maxima, metafont, mips, modelines, modula2, modula3, monobasic, nasm, noweb, objectivec, objectivecpp, ocaml, octave, pascal, perl, php, pike, postscript, prolog, python, r, relaxngcompact, rhtml, roff, ruby, rust, scala, scheme, sci, sed, sgml, sql, sqlmysql, sqlpostgresql, tcl, texinfo, verilog, vhdl, xml, xorg, xslt, xul, yacc, yaml
                  Default user data directory: /home/xiaolong/.pandoc
                  Copyright (C) 2006-2013 John MacFarlane
                  Web:  http://johnmacfarlane.net/pandoc
                  This is free software; see the source for copying conditions.  There is no
                  warranty, not even for merchantability or fitness for a particular purpose.
                  

                  我正在尝试以下方法:

                  ```python
                  Python 3.4.3 |Anaconda 2.3.0 (64-bit)| (default, Oct 19 2015, 21:52:17)
                  [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
                  Type "help", "copyright", "credits" or "license" for more information.
                  >>> import random  # seed is determined here, if not set by the developer themself
                  >>> random.randint(0, 100)
                  50
                  >>> random.randint(0, 100)
                  62
                  >>> random.randint(0, 100)
                  53
                  >>> random.randint(0, 100)
                  17
                  >>> random.seed("I am a hashable object.")
                  >>> random.randint(0, 100)
                  41
                  >>> random.seed("I am a hashable object.")
                  >>> random.randint(0, 100)
                  41
                  >>> random.randint(0, 100)
                  88
                  >>> random.seed("I am a hashable object.")
                  >>> random.randint(0, 100)
                  41
                  >>> random.randint(0, 100)
                  88
                  ````````````````````````````````````````````````````````````````````````````````
                  

                  我使用的编译 PDF 的命令是:

                  The command to compile my PDF I use is:

                  pandoc --read=markdown --table-of-contents --toc-depth=2 --preserve-tabs --standalone --template=template.latex --latex-engine=xelatex Hausarbeit.md --highlight-style=pygments -o Hausarbeit.pdf
                  

                  这是我的 template.latex 中的代码:

                  This is code I have in my template.latex:

                  $if(highlighting-macros)$
                  $highlighting-macros$
                  $endif$
                  $if(verbatim-in-note)$
                  usepackage{fancyvrb}
                  $endif$
                  

                  根据 Pandoc 文档 Pandoc 文档,这应该会导致突出显示的文本Python 语言.但是,该代码块中的所有内容都只会变成等宽,并且不会应用颜色.

                  According to the Pandoc documentation Pandoc documentation this should result in highlighted text for the Python language. However, everything in that code block only becomes monospace and no colors are applied.

                  更何况,编译的时候出错了:

                  What's more is, that there is an error when compiling:

                  pandoc: Error producing PDF from TeX source.
                  ! LaTeX Error: Environment Shaded undefined.
                  
                  See the LaTeX manual or LaTeX Companion for explanation.
                  Type  H <return>  for immediate help.
                   ...                                              
                  
                  GenericError  ...                                
                                                                    endgroup 
                  l.200 egin{Shaded}
                  

                  我的猜测是,模板中缺少定义 Shaded 的内容.我什至安装了一些名为 libghc-highlighting-kate-devhighlighting-kate 包,因为我在某处读到,这是 pandoc 使用的,但无济于事,文本保持黑色.

                  My guess is, that there is something missing in the template to define Shaded. I even installed some package of highlighting-kate named libghc-highlighting-kate-dev, because I read somewhere, that this is what pandoc uses, but to no avail, the text stays black.

                  如何让语法高亮工作?

                  编辑#1

                  当我简单地缩进代码以使用代码的标准降价语法时,该错误没有出现.但在这种情况下,我本身不会有任何语法突出显示.

                  That error did not appear, when I simply indented the code to use standard markdown syntax for code. But in that case I'll not have any syntax highlighting per se.

                  编辑#2

                  标签PDF"、Python"和syntax-highlighting"确实是相关的,因为这专门用于创建 PDF 文件,并且专门用于语法突出显示.也可能只是在创建的 PDF 文件中突出显示 python 代码存在问题,因此 python 标签也是相关的.请在过快下结论之前阅读问题.

                  The tags "PDF", "Python" and "syntax-highlighting" are indeed related, since this is specifically about creating a PDF file and specifically about syntax highlighting. Also it could be that there is only a problem with highlighting python code in the created PDF files, so the python tag is also related. Please read the question before concluding too quickly.

                  推荐答案

                  尝试在 pandoc 编译命令中添加 --listings 选项:

                  Try to add --listings option to your pandoc compile command:

                  pandoc --read=markdown --table-of-contents --toc-depth=2 --preserve-tabs --standalone --template=template.latex --latex-engine=xelatex --listings Hausarbeit.md --highlight-style=pygments -o Hausarbeit.pdf
                  

                  这篇关于PDF中的Pandoc语法突出显示不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 Python 中使用 LaTeX 表示法格式化数字 下一篇:使用 IPython.display.Latex 时,LaTeX 方程不会在谷歌 Colaboratory 中呈现

                  相关文章

                  <tfoot id='LRYq0'></tfoot>
                  • <bdo id='LRYq0'></bdo><ul id='LRYq0'></ul>

                    <i id='LRYq0'><tr id='LRYq0'><dt id='LRYq0'><q id='LRYq0'><span id='LRYq0'><b id='LRYq0'><form id='LRYq0'><ins id='LRYq0'></ins><ul id='LRYq0'></ul><sub id='LRYq0'></sub></form><legend id='LRYq0'></legend><bdo id='LRYq0'><pre id='LRYq0'><center id='LRYq0'></center></pre></bdo></b><th id='LRYq0'></th></span></q></dt></tr></i><div id='LRYq0'><tfoot id='LRYq0'></tfoot><dl id='LRYq0'><fieldset id='LRYq0'></fieldset></dl></div>

                    <small id='LRYq0'></small><noframes id='LRYq0'>

                  1. <legend id='LRYq0'><style id='LRYq0'><dir id='LRYq0'><q id='LRYq0'></q></dir></style></legend>