如何在R markdown中创建线间光泽度? [英] How to create interlinear gloss in R markdown?

查看:95
本文介绍了如何在R markdown中创建线间光泽度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在R markdown中创建一个线性光泽度,其中光泽度与其提供有关信息的单词对齐.

I would like to create an interlinear gloss in R markdown, in which glosses are aligned with the words that they are providing information about.

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

In the following example, I want the left edge of each character string in the German sentence on top to be aligned with the left edge of each character string of the English beneath it:

  1. Ich habe den Bub gesehen

  1. Ich habe den Bub gesehen

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

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

因此,"boy.ACC.SG"的左边缘应在"Bub"的左边缘正下方对齐.

So the left edge of "boy.ACC.SG" should be aligned right beneath the left edge of "Bub."

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

Packages like gb4e do this in TeX, but I don't know how to align text this way in markdown.

推荐答案

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

There are some pandoc filters available that might actually help, e.g. pangloss, which is python-based and can be installed via pip. To use it in an rmarkdown document, specify in yaml that pangloss should be used as a filter:

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

Pangloss实际上似乎将gb4e软件包用于pdf输出,因此您可能必须将其包含在序言中,以便使整个过程变得

Pangloss actually seems to use the gb4e package for pdf outputting, so you may have to include it in your preamble, so that the whole thing becomes

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

和add_to_preamble.tex必须包含该行

and add_to_preamble.tex must contain the line

\usepackage{gb4e}

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

The actual examples are included in markdown the following way (this is the example given at pangloss's github page)

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 markdown中创建线间光泽度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆