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 |
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.
cond_cmpl(ipa)
cond_cmpl(ipa)
ipa |
String. A sequence of IPA symbols. |
knitr::include_graphics
to Deal with URLs and Invalid File TypesDeals 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
.
include_graphics2(path, alt_path = NULL, handler = function(path) knitr::asis_output(paste("View", tools::file_ext(path), "at", path)), ...)
include_graphics2(path, alt_path = NULL, handler = function(path) knitr::asis_output(paste("View", tools::file_ext(path), "at", path)), ...)
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 |
handler |
Function. A function with a single argument |
... |
Other arguments to pass to
|
Read more about using the function at http://bit.ly/include_graphics2.
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)
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
searchIPA(x = NULL, search = c("feature", "xsampa"))
searchIPA(x = NULL, search = c("feature", "xsampa"))
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 |
search |
Character. Search mode, either |
A data frame with 3 rows.
# Check all IPA symbols searchIPA() # Search with feature searchIPA("bilabial", "feature") # Search with X-SAMPA searchIPA("_h", "xsampa")
# Check all IPA symbols searchIPA() # Search with feature searchIPA("bilabial", "feature") # Search with X-SAMPA searchIPA("_h", "xsampa")
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(/
).
writeIPA()
writeIPA()
Inserted plain text at the cursor returned by
insertText
.
https://github.com/dmort27/epitran/blob/master/epitran/data/ipa-xsampa.csv