Skip to content

Commit

Permalink
make up the special treatment of the .bib extension on Windows remove…
Browse files Browse the repository at this point in the history
…d in 82d6bd8
  • Loading branch information
yihui committed Nov 16, 2017
1 parent 2f2a420 commit 1a0db72
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion R/util.R
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,19 @@ latexmk_emu <- function(file, engine, biblatex = FALSE) {

require_bibtex <- function(aux) {
x <- readLines(aux)
length(grep('^\\\\citation\\{', x)) && length(grep('^\\\\bibdata\\{', x)) &&
r <- length(grep('^\\\\citation\\{', x)) && length(grep('^\\\\bibdata\\{', x)) &&
length(grep('^\\\\bibstyle\\{', x))
if (r && is_windows()) tweak_aux(aux, x)
r
}

# remove the .bib extension in \bibdata{} in the .aux file, because bibtex on
# Windows requires no .bib extension (sigh)
tweak_aux <- function(aux, x = readLines(aux)) {
r <- '^\\\\bibdata\\{.+\\}\\s*$'
if (length(i <- grep(r, x)) == 0) return()
x[i] = gsub('[.]bib([,}])', '\\1', x[i])
writeLines(x, aux)
}

system2_quiet <- function(..., error = NULL) {
Expand Down

0 comments on commit 1a0db72

Please sign in to comment.