Title: | Journal Abbreviations for BibTeX Documents |
---|---|
Description: | Since the reference management software (such as 'Zotero', 'Mendeley') exports Bib file journal abbreviation is not detailed enough, the 'journalabbr' package only abbreviates the journal field of Bib file, and then outputs a new Bib file for generating reference format with journal abbreviation on other software (such as 'texstudio'). The abbreviation table is from 'JabRef'. At the same time, 'Shiny' application is provided to generate 'thebibliography', a reference format that can be directly used for latex paper writing based on 'Rmd' files. |
Authors: | ShuCai Zou [aut, cre], Yu Chen [aut] |
Maintainer: | ShuCai Zou <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.4.4 |
Built: | 2025-02-03 05:56:00 UTC |
Source: | https://github.com/zoushucai/journalabbr |
The bib2bib
function reads a BibTeX file, replaces the journal field using a custom or
system-provided abbreviation table, optionally applies a function to the author field,
and writes the result back to a new BibTeX file.
bib2bib( file, out.file, user_table = NULL, use_sys_table = TRUE, fun = NULL, ... )
bib2bib( file, out.file, user_table = NULL, use_sys_table = TRUE, fun = NULL, ... )
file |
A string representing the path to the input |
out.file |
A string representing the path where the output |
user_table |
A user-provided abbreviation table. It can be a file path (string),
a |
use_sys_table |
Logical. Whether to include the system abbreviation table ( |
fun |
A function (optional) to apply to the "author" field in the |
... |
Additional arguments passed to the custom function |
The function works in the following steps:
Reads a custom journal abbreviation table from a CSV file (if provided).
Reads the input BibTeX file and converts it into a data.table
.
Replaces the JOURNAL
field with abbreviations from the provided or system abbreviation table.
Optionally applies the provided function to the AUTHOR
field.
Writes the modified data back to a new BibTeX file.
None. The function writes the processed data to the specified output file.
bib_file <- system.file("extdata", "testfile_2.bib", package = "journalabbr", mustWork = TRUE) csv_file <- system.file("extdata", "myabbr.csv", package = "journalabbr", mustWork = TRUE) output_file <- tempfile(fileext = ".bib") dt <- bib2bib(file = bib_file, out.file = output_file, user_table = csv_file, use_sys_table = TRUE, fun = function(x) { gsub(" and ", " & ", x, perl = TRUE, ignore.case = TRUE) })
bib_file <- system.file("extdata", "testfile_2.bib", package = "journalabbr", mustWork = TRUE) csv_file <- system.file("extdata", "myabbr.csv", package = "journalabbr", mustWork = TRUE) output_file <- tempfile(fileext = ".bib") dt <- bib2bib(file = bib_file, out.file = output_file, user_table = csv_file, use_sys_table = TRUE, fun = function(x) { gsub(" and ", " & ", x, perl = TRUE, ignore.case = TRUE) })
This function processes a user-provided abbreviation table and optionally merges it with a system abbreviation table.
The user table can be provided as a file path, data.frame
, or data.table
.
The system table is included by default but can be excluded.
get_abbrtable(user_table = NULL, use_sys_table = TRUE)
get_abbrtable(user_table = NULL, use_sys_table = TRUE)
user_table |
A user-provided abbreviation table. It can be a file path (string), a |
use_sys_table |
Logical. Whether to include the system abbreviation table ( |
The function first processes the user-provided table by checking its type:
If it's a file path, it reads the file using data.table::fread
.
If it's a data.frame
, it is converted to a data.table
.
If it's already a data.table
, no conversion is needed.
After processing the user table, the system table (abbrtable_sys
) is optionally included in the final merged table.
Duplicate entries based on journal_lower
are removed.
A data.table
containing the merged abbreviation table, with any duplicates (by journal_lower
) removed.
The resulting table contains two columns: journal_lower
and journal_abbr
.
# Example 1: Provide a user table as a CSV file path and merge with system table user_table_path <- system.file("extdata", "myabbr.csv", package = "journalabbr", mustWork = TRUE) abbr_table <- get_abbrtable(user_table = user_table_path, use_sys_table = TRUE) # Example 2: Provide a user table as a data.frame user_df <- data.frame(journal_lower = c("example journal", "sample journal"), journal_abbr = c("EJ", "SJ")) abbr_table <- get_abbrtable(user_table = user_df, use_sys_table = FALSE) # Example 3: Use only the system table abbr_table <- get_abbrtable(use_sys_table = TRUE) abbr_table <- get_abbrtable(user_table=NULL, use_sys_table = FALSE)
# Example 1: Provide a user table as a CSV file path and merge with system table user_table_path <- system.file("extdata", "myabbr.csv", package = "journalabbr", mustWork = TRUE) abbr_table <- get_abbrtable(user_table = user_table_path, use_sys_table = TRUE) # Example 2: Provide a user table as a data.frame user_df <- data.frame(journal_lower = c("example journal", "sample journal"), journal_abbr = c("EJ", "SJ")) abbr_table <- get_abbrtable(user_table = user_df, use_sys_table = FALSE) # Example 3: Use only the system table abbr_table <- get_abbrtable(use_sys_table = TRUE) abbr_table <- get_abbrtable(user_table=NULL, use_sys_table = FALSE)
Returns the default list of columns that will be deleted.
get_delcolumns()
get_delcolumns()
A character vector containing the default column names to be excluded.
data.table
.The BibTeX file is read, parsed, tidied and written to a data.table
.
read_bib2dt(file, encoding = "UTF-8")
read_bib2dt(file, encoding = "UTF-8")
file |
character, path or URL to a bib file. |
encoding |
character, encoding to be passed to |
Read, parse and collate bibtex file to form a data.table. Different BIB may produce different data.table columns.
A data.table
.
ShuCai Zou
readLines
for more details on reading text files.
# Read from .bib file: require(journalabbr) require(purrr) require(data.table) file1 <- system.file("extdata", "testfile_1.bib", package = "journalabbr", mustWork = TRUE) dt1 <- read_bib2dt(file1) colnames(dt1) file2 <- system.file("extdata", "testfile_2.bib", package = "journalabbr", mustWork = TRUE) dt2 <- read_bib2dt(file2) colnames(dt2) # A valid BibTeX entry as a character vector item1 <- c( "@Article{switalski2003general,", "author = {Switalski, Zbigniew},", "journal = {Fuzzy Sets and Systems},", "title = {General transitivity conditions for fuzzy reciprocal preference matrices},", "year = {2003},", "number = {1},", "pages = {85--100},", "volume = {137},", "publisher = {Elsevier},", "}" ) item2 <- c( "@Article{switalski2003general,", "author = {Switalski, Zbigniew},", "journal = {Fuzzy Sets and Systems},", "title = {General transitivity conditions for fuzzy reciprocal preference matrices},", "year = {2003}}" ) item3 <- c( "@Article{switalski2003general,", "author = {Switalski, Zbigniew},", "journal = {Fuzzy Sets and Systems},", "title = {General transitivity conditions for fuzzy reciprocal preference matrices},", "year = {2003}" ) item = list(item1, item2, item3) # Check validity of the entries (inner function) map(item, journalabbr:::checkitem_valid) map(item, journalabbr:::extract_fields) rbindlist(map(item, journalabbr:::extract_fields), fill=TRUE, use.names = TRUE) rbindlist(map(item, journalabbr:::extract_fields, check=TRUE), fill=TRUE, use.names = TRUE)
# Read from .bib file: require(journalabbr) require(purrr) require(data.table) file1 <- system.file("extdata", "testfile_1.bib", package = "journalabbr", mustWork = TRUE) dt1 <- read_bib2dt(file1) colnames(dt1) file2 <- system.file("extdata", "testfile_2.bib", package = "journalabbr", mustWork = TRUE) dt2 <- read_bib2dt(file2) colnames(dt2) # A valid BibTeX entry as a character vector item1 <- c( "@Article{switalski2003general,", "author = {Switalski, Zbigniew},", "journal = {Fuzzy Sets and Systems},", "title = {General transitivity conditions for fuzzy reciprocal preference matrices},", "year = {2003},", "number = {1},", "pages = {85--100},", "volume = {137},", "publisher = {Elsevier},", "}" ) item2 <- c( "@Article{switalski2003general,", "author = {Switalski, Zbigniew},", "journal = {Fuzzy Sets and Systems},", "title = {General transitivity conditions for fuzzy reciprocal preference matrices},", "year = {2003}}" ) item3 <- c( "@Article{switalski2003general,", "author = {Switalski, Zbigniew},", "journal = {Fuzzy Sets and Systems},", "title = {General transitivity conditions for fuzzy reciprocal preference matrices},", "year = {2003}" ) item = list(item1, item2, item3) # Check validity of the entries (inner function) map(item, journalabbr:::checkitem_valid) map(item, journalabbr:::extract_fields) rbindlist(map(item, journalabbr:::extract_fields), fill=TRUE, use.names = TRUE) rbindlist(map(item, journalabbr:::extract_fields, check=TRUE), fill=TRUE, use.names = TRUE)
This function processes a specified field in a data.table
by using a journal abbreviation table
(either user-specified, system-provided, or both) to abbreviate journal names in the oldfield
.
Additionally, a custom function can be applied to the processed field if specified.
replace_field( dt, oldfield, newfield, user_table = NULL, use_sys_table = TRUE, fun = NULL, ... )
replace_field( dt, oldfield, newfield, user_table = NULL, use_sys_table = TRUE, fun = NULL, ... )
dt |
A |
oldfield |
A character string. The name of the field to be processed, typically in uppercase
(e.g., "JOURNAL"). Must be a valid column name in |
newfield |
A character string. The name of the new field where the processed result will be stored.
If this field does not exist in |
user_table |
A |
use_sys_table |
A logical. Whether to use the system-provided journal abbreviation table.
Defaults to |
fun |
A function. Optional. A custom function to apply to the processed field after abbreviation
(if applicable). Defaults to |
... |
Additional arguments passed to the custom function |
If the oldfield
is "JOURNAL", the function will attempt to apply journal abbreviations using the provided
abbreviation table(s). The abbreviation process involves converting the journal names to lowercase and
removing excess whitespace before matching against the abbreviation table.
The user_table
and use_sys_table
parameters allow flexibility in choosing which abbreviation
tables to use. If both are used, they will be merged, and duplicates will be removed.
If a custom function is provided via fun
, it will be applied to the processed field after any abbreviations.
The function returns the modified data.table
with the processed field stored in newfield
.
csvpath <- system.file("extdata", "myabbr.csv", package = "journalabbr", mustWork = TRUE) file <- system.file("extdata", "testfile_2.bib", package = "journalabbr", mustWork = TRUE) dt <- read_bib2dt(file) abbrtable_user = get_abbrtable(user_table = csvpath, use_sys_table =TRUE) print(head(abbrtable_user)) dm1 = replace_field(dt, oldfield = "JOURNAL", newfield = "JOURNAL", user_table = csvpath, use_sys_table =TRUE, fun = NULL) myauthor = function(x){ gsub(" and ", " & ", x, perl = TRUE, ignore.case = TRUE) } dm2 = replace_field(dm1, oldfield = "AUTHOR", newfield = "AUTHOR", user_table = NULL, use_sys_table =FALSE, fun = myauthor) print(head(dt)[, c("JOURNAL", "AUTHOR"), with = FALSE]) print(head(dm1)[, c("JOURNAL", "AUTHOR"), with = FALSE]) print(head(dm2)[, c("JOURNAL", "AUTHOR"), with = FALSE])
csvpath <- system.file("extdata", "myabbr.csv", package = "journalabbr", mustWork = TRUE) file <- system.file("extdata", "testfile_2.bib", package = "journalabbr", mustWork = TRUE) dt <- read_bib2dt(file) abbrtable_user = get_abbrtable(user_table = csvpath, use_sys_table =TRUE) print(head(abbrtable_user)) dm1 = replace_field(dt, oldfield = "JOURNAL", newfield = "JOURNAL", user_table = csvpath, use_sys_table =TRUE, fun = NULL) myauthor = function(x){ gsub(" and ", " & ", x, perl = TRUE, ignore.case = TRUE) } dm2 = replace_field(dm1, oldfield = "AUTHOR", newfield = "AUTHOR", user_table = NULL, use_sys_table =FALSE, fun = myauthor) print(head(dt)[, c("JOURNAL", "AUTHOR"), with = FALSE]) print(head(dm1)[, c("JOURNAL", "AUTHOR"), with = FALSE]) print(head(dm2)[, c("JOURNAL", "AUTHOR"), with = FALSE])
The Shiny Program for the 'journalabbr' Package
run_example()
run_example()
This function processes a given string by cleaning up extra spaces, handling punctuation, and adjusting mathematical symbols according to specific formatting rules.
This function takes a vector of LaTeX-formatted strings and applies the single_add_space
function to each string to standardize spacing throughout the document.
single_add_space(text) tex_funs(tex, fun = single_add_space, ...)
single_add_space(text) tex_funs(tex, fun = single_add_space, ...)
text |
A single character string (input text) that needs to be processed. |
tex |
A vector of strings (LaTeX document or text) to be processed. |
fun |
The function to be applied to each string in the vector (default is |
... |
Additional arguments to be passed to the function. |
see function single_add_space
source code for details.
A cleaned-up string where multiple spaces are reduced to one, unnecessary spaces are removed, and spaces are appropriately added around certain punctuation and mathematical symbols.
A vector of processed strings where unnecessary spaces have been removed or adjusted.
tex =c("This is a citation,and.", "This is a citation2 $x ^ 2+y^ 2 = z^2.$ and this is equ", "this is no , citation") tex = tex_funs(tex) print(tex)
tex =c("This is a citation,and.", "This is a citation2 $x ^ 2+y^ 2 = z^2.$ and this is equ", "this is no , citation") tex = tex_funs(tex) print(tex)
This function converts citations in a given text between LaTeX and Markdown formats. It can handle multiple LaTeX citation styles and produces the appropriate format based on the specified direction. Note that the input text must have a length of 1.
the cites_convert
function applies single_cites_convert
to each element of the input vector.
single_cites_convert( text, pattern = NULL, tex2md = TRUE, latex_prefix = c("cite", "upcite", "citep", "citet") ) cites_convert(x, ...)
single_cites_convert( text, pattern = NULL, tex2md = TRUE, latex_prefix = c("cite", "upcite", "citep", "citet") ) cites_convert(x, ...)
text |
A character string containing the text with citations, Note that the input text must have a length of 1. |
pattern |
A regular expression pattern for matching citations. If NULL, defaults to a pattern based on the citation direction. |
tex2md |
Logical; if TRUE, converts from LaTeX to Markdown; if FALSE, converts from Markdown to LaTeX. |
latex_prefix |
A character vector of LaTeX citation prefixes to use. Defaults to c("cite", "upcite", "citep", "citet"). |
x |
A character vector containing texts with citations. |
... |
Additional arguments passed to |
the single_cites_convert
function return a character string with citations converted to the specified format.
the cites_convert
function return a character vector with citations converted to the specified format.
# Example text containing various LaTeX citations # Convert the LaTeX citations in the text to Markdown format text = "This is a citation \\upcite{key1,key2} and \\citep{key3-a }. paper \\cite{key3-b, cky3-c}, paper \\citet{key4-a, cky4-b}" converted_md = single_cites_convert(text, tex2md = TRUE) print(converted_md) # Example text containing Markdown citations # Convert the Markdown citations back to LaTeX format text = "This is a citation [@key1; @key2] and [@key3-a]. paper [@key3-b; @cky3-c], paper [@key4-a; @cky4-b]" # defalut prefix "cite" converted_latex = single_cites_convert(text, tex2md = FALSE) print(converted_latex) # Convert Markdown citations to LaTeX using a custom prefix custom_prefix = single_cites_convert(text, tex2md = FALSE, latex_prefix = "upcite") print(custom_prefix) # A vector of texts with Markdown citations tex =c("This is a citation [@key1; @key2] and [@key3-a].", "This is a citation2 [@key1; @key2] and [@key3-a].", "this is no citation", "", "This is a citation3 [@key1; @key2] and [@key3-a].") # vector version tex = cites_convert(tex, tex2md = FALSE) print(tex) # Another vector of texts containing LaTeX citations tex2= c("This is a citation \\upcite{key1,key2} and \\citep{key3-a }", "This is a citation \\citet{key1,key2} and \\citet{key3-a }", "this is no citation", "", "This is a citation \\upcite{key1,key2} and \\cite{key3-a }") # Convert the vector of LaTeX citations to Markdown format tex2 = cites_convert(tex2, tex2md = TRUE) print(tex2)
# Example text containing various LaTeX citations # Convert the LaTeX citations in the text to Markdown format text = "This is a citation \\upcite{key1,key2} and \\citep{key3-a }. paper \\cite{key3-b, cky3-c}, paper \\citet{key4-a, cky4-b}" converted_md = single_cites_convert(text, tex2md = TRUE) print(converted_md) # Example text containing Markdown citations # Convert the Markdown citations back to LaTeX format text = "This is a citation [@key1; @key2] and [@key3-a]. paper [@key3-b; @cky3-c], paper [@key4-a; @cky4-b]" # defalut prefix "cite" converted_latex = single_cites_convert(text, tex2md = FALSE) print(converted_latex) # Convert Markdown citations to LaTeX using a custom prefix custom_prefix = single_cites_convert(text, tex2md = FALSE, latex_prefix = "upcite") print(custom_prefix) # A vector of texts with Markdown citations tex =c("This is a citation [@key1; @key2] and [@key3-a].", "This is a citation2 [@key1; @key2] and [@key3-a].", "this is no citation", "", "This is a citation3 [@key1; @key2] and [@key3-a].") # vector version tex = cites_convert(tex, tex2md = FALSE) print(tex) # Another vector of texts containing LaTeX citations tex2= c("This is a citation \\upcite{key1,key2} and \\citep{key3-a }", "This is a citation \\citet{key1,key2} and \\citet{key3-a }", "this is no citation", "", "This is a citation \\upcite{key1,key2} and \\cite{key3-a }") # Convert the vector of LaTeX citations to Markdown format tex2 = cites_convert(tex2, tex2md = TRUE) print(tex2)
single_cites_extract
function extracts all citation keys from a LaTeX string based on specific citation commands.
cites_extract
function extracts all unique citation keys from a LaTeX document.
single_cites_extract(text) cites_extract(tex)
single_cites_extract(text) cites_extract(tex)
text |
A character vector containing LaTeX content. |
tex |
A character vector where each element represents a line or section of LaTeX content. |
The function identifies citation commands such as cite
, upcite
, citep
, and citet
.
It extracts the content within braces following these commands, and splits multiple keys separated by commas.
This function uses single_cites_extract
to extract citation keys from each line
or section of the LaTeX document. It removes duplicates and trims unnecessary whitespace.
A character vector of citation keys, or NULL
if no citations are found.
A unique character vector of citation keys.
tex= c("This is a citation \\upcite{key1,key2} and \\citep{key3-a }", "This is a citation \\citet{key1,key2} and \\citet{key3-a }", "this is no citation", "", "This is a citation \\upcite{key1,key4} and \\cite{key3-a }") cites_extract(tex)
tex= c("This is a citation \\upcite{key1,key2} and \\citep{key3-a }", "This is a citation \\citet{key1,key2} and \\citet{key3-a }", "this is no citation", "", "This is a citation \\upcite{key1,key4} and \\cite{key3-a }") cites_extract(tex)
single_replace_author
function modifies LaTeX citation commands to add parentheses around them,
transforming commands such as \cite{...}
into (\cite{...})
.
cites_replace_author
function processes a LaTeX document to transform all numeric citations into author-year style
by wrapping citation commands in parentheses.
single_replace_number
function transforms LaTeX citation commands from an author-year style (e.g., (\cite{...})
)
back to their original form (e.g., \cite{...}
).
cites_replace_number
function processes a LaTeX document to remove parentheses around citation commands,
converting citations from an author-year style back to numeric style.
single_replace_author( text, latex_prefix = c("cite", "upcite", "citep", "citet") ) cites_replace_author(tex) single_replace_number( text, latex_prefix = c("cite", "upcite", "citep", "citet") ) cites_replace_number(tex)
single_replace_author( text, latex_prefix = c("cite", "upcite", "citep", "citet") ) cites_replace_author(tex) single_replace_number( text, latex_prefix = c("cite", "upcite", "citep", "citet") ) cites_replace_number(tex)
text |
A single string of LaTeX content. |
latex_prefix |
A character vector of LaTeX citation commands to be matched
(default: |
tex |
A character vector where each element represents a line or section of LaTeX content. |
The function searches for LaTeX citation commands using regular expressions. For each matched command, it appends and prepends parentheses to create the author-year citation style. Excessive whitespace in the resulting text is removed to ensure formatting consistency.
If no matching citation commands are found, the input text is returned unchanged.
This function applies single_replace_author
to each line or section of the LaTeX document,
ensuring that citation commands such as \cite{...}
and \citet{...}
are converted into
(\cite{...})
and (\citet{...})
, respectively.
The function identifies citation commands enclosed in parentheses and removes the parentheses, restoring the original citation format. Excessive whitespace in the resulting text is removed for formatting consistency.
If no matching citation commands are found, the input text is returned unchanged.
This function applies single_replace_number
to each line or section of the LaTeX document,
ensuring that citations like (\cite{...})
are transformed back into \cite{...}
.
A string where all matched citation commands are wrapped in parentheses.
A character vector with LaTeX content where all citation commands are converted to author-year style.
A string where parentheses around matched citation commands are removed.
A character vector with LaTeX content where parentheses around citation commands are removed.
tex= c("This is a citation \\upcite{key1,key2} and \\citep{key3-a }", "This is a citation \\citet{key1,key2} and \\citet{key3-a }", "this is no citation", "", "This is a citation \\upcite{key1,key4} and \\cite{key3-a }") tex = cites_replace_author(tex) print(tex) tex2 = cites_replace_number(tex) print(tex2)
tex= c("This is a citation \\upcite{key1,key2} and \\citep{key3-a }", "This is a citation \\citet{key1,key2} and \\citet{key3-a }", "this is no citation", "", "This is a citation \\upcite{key1,key4} and \\cite{key3-a }") tex = cites_replace_author(tex) print(tex) tex2 = cites_replace_number(tex) print(tex2)
single_replace_order
function modifies LaTeX citation commands to reorder citation keys based on a provided order.
cites_replace_order
function processes a LaTeX document to reorder all citation keys within citation commands
based on their first appearance in the document.
single_replace_order( text, citesall = NULL, latex_prefix = c("cite", "upcite", "citep", "citet") ) cites_replace_order(tex, citesall = NULL)
single_replace_order( text, citesall = NULL, latex_prefix = c("cite", "upcite", "citep", "citet") ) cites_replace_order(tex, citesall = NULL)
text |
A single string of LaTeX content. |
citesall |
A character vector containing all citation keys in the desired order. If not provided, default applies |
latex_prefix |
A character vector of LaTeX citation commands to be matched (default: |
tex |
A character vector where each element represents a line or section of LaTeX content. |
The function identifies LaTeX citation commands and reorders their arguments (e.g., \cite{key1,key2}
)
to match the order specified in citesall
. If a citation contains only one key, it remains unchanged.
Matched citation keys not found in citesall
are excluded from the reordered result.
The function extracts all citation keys using cites_extract
, determines their order based on first occurrence,
and applies single_replace_order
to reorder keys in each citation command.
A string with citation keys reordered within the specified citation commands.
A character vector with updated LaTeX content where citation keys in commands are reordered.
single_replace_order
, cites_extract
tex= c("This is a citation \\upcite{key1,key2} and \\citep{key3-a }", "This is a citation \\citet{key1,key2} and \\citet{key3-a }", "this is no citation", "", "This is a citation \\upcite{key1,key4} and \\cite{key3-a }") citesall = cites_extract(tex) citesall = c("key2", "key1", "key3-a", "key4") cites_replace_order(tex, citesall)
tex= c("This is a citation \\upcite{key1,key2} and \\citep{key3-a }", "This is a citation \\citet{key1,key2} and \\citet{key3-a }", "this is no citation", "", "This is a citation \\upcite{key1,key4} and \\cite{key3-a }") citesall = cites_extract(tex) citesall = c("key2", "key1", "key3-a", "key4") cites_replace_order(tex, citesall)
data.table
to a .bib file.The BibTeX data.table
is written to a .bib file.
write_dt2bib( dt, file = tempfile(fileext = ".bib"), columns = get_delcolumns(), indent = "\t" )
write_dt2bib( dt, file = tempfile(fileext = ".bib"), columns = get_delcolumns(), indent = "\t" )
dt |
|
file |
character, file path to write the .bib file. |
columns |
character vector, names of the columns to exclude from the output. a default list of columns will
be used from |
indent |
character, the indentation to use for the .bib file. Default is |
file
as a character string, invisibly.
# Read from .bib file: require(journalabbr) file <- system.file("extdata", "testfile_2.bib", package = "journalabbr", mustWork = TRUE) bib <- read_bib2dt(file) # Write to .bib file: write_dt2bib(bib, file = tempfile(fileext = ".bib"))
# Read from .bib file: require(journalabbr) file <- system.file("extdata", "testfile_2.bib", package = "journalabbr", mustWork = TRUE) bib <- read_bib2dt(file) # Write to .bib file: write_dt2bib(bib, file = tempfile(fileext = ".bib"))