Pandoc:docx和LaTeX格式的不同输出

时间:2019-05-23 21:21:49

标签: pandoc

例如,在LaTeX中,可以有一个不错的内联方程式,例如$x^2=4$,对于docx格式的斜体文本,我会很高兴。 有没有一种方法可以告诉Pandoc根据输出格式使用这些解决方案之一?
在寻找可能的解决方案时,我意识到pandoc具有过滤器和模板。我不太明白该朝哪个方向前进。
但我真的很想提供一个更通用的解决方案,该解决方案也适用于类似的任务,例如,数字和单位之间的较小间距:在LaTeX中,简单的$\;$包含在我的Markdown文档中在DOCX或ODT输出中不能给我令人满意的结果。

1 个答案:

答案 0 :(得分:0)

这是我从pandoc manual中找到的

$(function addIstPIR() {
        var i = @Model.pt3041iResourseBlockedSnyatyZamechaniya.Count-1;
        $('.addIstPIR').click(function () {
            i++;
            var html2Add = "<div class='col-xs-12 col-sm-12 col-md-9 col-lg-6 form-material floating padding-horizontal-3 '>" +
                                "<select class='form-control' data-val='true' data-val-required='This field is required * !.' id='pt3041iResourseBlockedSnyatyZamechaniya_" + i + "__pt3041iResourseBlockedSnyatyZamechaniya' name='pt3041iResourseBlockedSnyatyZamechaniya[" + i + "].pt3041iResourseBlockedSnyatyZamechaniya'>" +
                                    "<option selected='selected'></option>" +
                                    "<option value='1'>Select 1</option>" +
                                    "<option value='2'>Select 2</option>" +
                                    "<option value='5'>Select 3</option>" +
                                    "<option value='6'>Select 4</option>" + 
                                "</select>" +
                                "<label class='floating-label text-truncate' for='pt3041iResourseBlockedSnyatyZamechaniya_" + i + "__pt3041iResourseBlockedSnyatyZamechaniya'>Some text</label>" +
                                "<span class='text-danger field-validation-valid' data-valmsg-for='pt3041iResourseBlockedSnyatyZamechaniya[" + i + "].pt3041iResourseBlockedSnyatyZamechaniya' data-valmsg-replace='true'></span>" +
                            "</div>" +
                            "<div class='form-material floating'>" +
                                "<input id='pt3041iResourseBlockedSnyatyZamechaniya_" + i + "__ppt3041id' name='pt3041iResourseBlockedSnyatyZamechaniya[" + i + "].ppt3041id' value='0' type='hidden'/>" +
                            "</div>" +
                            "<div class='col-xs-12 col-sm-9 col-md-7 col-lg-5  form-material floating'>" +
                               "<input class='form-control tDecimal3' data-val='true' data-val-number='The field Some text must be a number' data-val-required='Some text.' id='pt3041iResourseBlockedSnyatyZamechaniya_" + i + "__pt3041ivolume' name='pt3041iResourseBlockedSnyatyZamechaniya[" + i + "].pt3041ivolume' value='' type='text'>" +
                               "<label class='floating-label text-truncate' for='pt3041iResourseBlockedSnyatyZamechaniya_" + i + "__pt3041ivolume'>Some Text</label>" +
                             "</div>";
            $('#IFPIRBlock').append(html2Add);
        })
    })

,请阅读该手册的-reference-doc = FILE 部分

For docx output, styles will be defined in the output file as inheriting from normal
text, if the styles are not yet in your reference.docx. If they are already defined,
pandoc will not alter the definition.

如何在pandoc中使用参考文档?

  1. 创建一个空的docx文件并重命名(例如,refer.docx)
  2. 定义要显示的样式
  3. 在pandoc命令行中添加“ --reference-doc =(refer.docx路径)”。