Package 'linguisticsdown'

Title: Easy Linguistics Document Writing with R Markdown
Description: Provides 'Shiny gadgets' to search, type, and insert IPA symbols into documents or scripts, requiring only knowledge about phonetics or 'X-SAMPA'. Also provides functions to facilitate the rendering of IPA symbols in 'LaTeX' and PDF format, making IPA symbols properly rendered in all output formats. A minimal R Markdown template for authoring Linguistics related documents is also bundled with the package. Some helper functions to facilitate authoring with R Markdown is also provided.
Authors: Yongfu Liao [aut, cre, cph]
Maintainer: Yongfu Liao <[email protected]>
License: MIT + file LICENCE
Version: 1.2.0
Built: 2024-11-10 04:15:11 UTC
Source: https://github.com/liao961120/linguisticsdown

Help Index


Conditional Compilation

Description

cond_cmpl wraps a sequence of IPA string with LaTeX code in R Markdown document when compiled to LaTeX. When compiled to HTML, returns the original sequence.

Usage

cond_cmpl(ipa)

Arguments

ipa

String. A sequence of IPA symbols.


Wrapper of knitr::include_graphics to Deal with URLs and Invalid File Types

Description

Deals with URL paths and invalid file types passed to path of include_graphics. When the output format of the R Markdown is PDF, and an URL is passed to path, the figure is automatically downloaded from the URL and included using the local relative path. If a figure has an invalid file extension for PDF output (e.g. .gif, .svg), the function passed to handler is used to override the default behavior: inserting figures with knitr::include_graphics.

Usage

include_graphics2(path, alt_path = NULL, handler = function(path)
  knitr::asis_output(paste("View", tools::file_ext(path), "at", path)),
  ...)

Arguments

path

String. Path to a figure to be included. Can be either an URL or a local path.

alt_path

String. An alternative figure path for path with invalid extensions. In the case of PDF ('LaTeX') output, invalid extensions are .gif, .svg.

handler

Function. A function with a single argument path. Used to insert alternative contents, such as a piece of text, when the figure cannot be inserted.

...

Other arguments to pass to include_graphics.

Details

Read more about using the function at http://bit.ly/include_graphics2.

Examples

png_url <- 'https://commonmark.org/images/markdown-mark.png'
gif_url <- 'https://media.giphy.com/media/k3dcUPvxuNpK/giphy.gif'

## Not run: 
include_graphics2(gif_url, alt_path = png_url)

## End(Not run)

Lookup IPA symbols with phonetic features or X-SAMPA

Description

Lookup IPA symbols with phonetic features or X-SAMPA

Usage

searchIPA(x = NULL, search = c("feature", "xsampa"))

Arguments

x

Character. A (partial) term of the features of an IPA symbol or the (partial) X-SAMPA symbol corresponding to an IPA symbol. Defaults to NULL, which returns all IPA symbols with corresponding features and X-SAMPA symbols.

search

Character. Search mode, either feature or xsampa.

Value

A data frame with 3 rows.

Examples

# Check all IPA symbols
searchIPA()

# Search with feature
searchIPA("bilabial", "feature")

# Search with X-SAMPA
searchIPA("_h", "xsampa")

Insert IPA symbols with Shiny app

Description

writeIPA opens a shiny gadget in the viewer pane of RStudio to let users insert a sequence of IPA symbols into the source pane or console. Users can choose to use phonetic features (such as aspirated, schwa, vl for voiceless, vd for voiced, etc.) to find IPA symbols or use the X-SAMPA input method directly. Note that due to the special meanings of backslash(\) in programming, backslashes(\) in X-SAMPA symbols are replaced with slashes(/).

Usage

writeIPA()

Value

Inserted plain text at the cursor returned by insertText.

Source

https://github.com/dmort27/epitran/blob/master/epitran/data/ipa-xsampa.csv