r - 如何在 R markdown 中创建行间光泽?

标签 r alignment markdown r-markdown text-alignment

我想在 R markdown 中创建行间注释,其中注释与它们提供信息的单词对齐。

在下面的示例中,我希望顶部德语句子中每个字符串的左边缘与其下面英语句子中每个字符串的左边缘对齐:

  1. Ich habe den Bub gesehen

    1sg.NOM 有.1sg.PRES DEF.ACC.SG boy.ACC.SG see.PERF.PART

因此“boy.ACC.SG”的左边缘应与“Bub”左边缘的正下方对齐。

gb4e这样的包在TeX中执行此操作,但我不知道如何在markdown中以这种方式对齐文本。

最佳答案

有一些 pandoc 过滤器可能确实有帮助,例如pangloss ,它基于 python,可以通过 pip 安装。要在 rmarkdown 文档中使用它,请在 yaml 中指定 pangloss 应用作过滤器:

---
title: My title
author: Somebody
output:
  pdf_document: 
    pandoc_args:
      - --filter
      - pangloss
---

Pangloss实际上似乎使用gb4e包进行pdf输出,所以你可能必须将它包含在你的序言中,这样整个事情就变成了

---
title: My title
author: Somebody
output:
  pdf_document: 
    pandoc_args:
      - --filter
      - pangloss
    includes:
        in_header: add_to_preamble.tex
---

并且 add_to_preamble.tex 必须包含该行

\usepackage{gb4e}

实际示例通过以下方式包含在 markdown 中(这是 pangloss 的 github 页面上给出的示例)

As you can see in the following examples, pangloss is really easy to use:

(@) Jorge  llama             a  Maria.
    George calls-3s.PRES.IND to Maria
    'George calls Maria.'
(@ex-french) Aussi, vous pouvez          avoir    de multiples   exemples.
    also   you  can-2p.PRES.IND have.INF of multiple-PL example-PL
    'You can also have multiple examples.'

You can even refer to examples, as in (@ex-french).

不过,这似乎仍然是一项正在进行的工作。

关于r - 如何在 R markdown 中创建行间光泽?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46383603/

相关文章:

r - 如何在 R 中导出 HTML 表格并控制线条边框?

r - R 中子图 plot_ly 中每个图附近的图例

regex - Emacs 调用对齐正则表达式

html - 我想水平对齐按钮并用 css 将它们居中

html - 如何在我的导航栏中使用 CSS 对齐我的 Logo ?

ruby - 自定义转换后如何将内容传递给 jekyll 默认转换器?

r - 具有不同结构的图的监督学习模型

r - 如何在直方图上绘制真实密度(对于指定的 Gamma 分布)

latex - 如何让 pandoc 单独留下百分号?

html - 如何使用 Markdown 将文本居中?