View source: R/cites_extract.R
single_cites_extract | R Documentation |
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)
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.