Usage of abbreviations

Hi everyone,

I would appreciate some help because web-searching didn't help.

I need to write a text in which a list of long phrases occur often and take time to type.
So I was wondering if there is any way I can set a list of abbreviations which I can expand in the text like this:
Example:
us = United States of America
when I type 'us' in the text to automatically expand to 'United States of America'.

I tried to google it and it took me to abbreviate() which does something else (I think). ChatGPT didn't help either.

Thanks a lot for your time and sorry if this is a dumb question.

Try autokey-gtk for Linux or AutoHotkey for Windows. I am not sure about Mac's.

1 Like

write your text then substitute your tokens for the longer snippets. in glue package tokens are easily identified in the text body by the use of curly braces.
example::

library(glue)

us <- "United States of America"
uk <- "United Kingdom of Great Britain and Northern Ireland"
glue("This is an article where I mention {us} often, but not as often as I say '{uk}'
     alright, first {us} fact is x; next {us} fact is y, 
     time for a {uk} fact.")
1 Like

That would be the R way to do that. Also with knitr no need for glue specifically. You can use inline R code for that.
Example of Markdown text

This is an article where I mention `r us` often, but not as often as I say `r uk` alright, first `r us` fact is x; next `r us` fact is y,  time for a `r uk` fact.

Also, note the glue has special engines to avoid calling glue() each time

Same with epoxy adapted for R Markdown document

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.