changeEncoding <- function(File, # 編集すべき *.html ファイル
encoding = "euc-jp", # *.html のエンコーディング
fleqn = TRUE, # LaTeX と同じように数式を若干左に寄せる
skip = TRUE #
)*%", s)) { # remarks s <- sub("^(
)*", "", s)
}
else if (grepl("\\\\tag\\{[0-9]+\\}", s)) { # \tag{n} as eqation number
eq.no <- eq.no+1
if (section == 0) {
s <- sub("\\\\tag\\{[0-9]+\\}", sprintf("\\\\tag{%i}", eq.no), s)
}
else {
s <- sub("\\\\tag\\{[0-9]+\\}", sprintf("\\\\tag{%i.%i}", section, eq.no), s)
}
}
else if (grepl("MathJax scripts", s) && fleqn == TRUE) { # equations to align left
s <- paste(s, '', sep="\n")
}
else if (grepl("\\\\
", s)) { # repair line ends \\ in align* environment
s <- sub("\\\\
", "\\\\\\\\", s)
}
#
if (grepl("^
\n", s, "\n", file=con)
}
else if (s == "
") {
cat("\n\n", file=con)
}
else if (s == " font-size: 12px;") { # body. td
cat(s, "\n line-height: 150%;\n", file=con)
}
else if (s != " border-left: 0.5em #EEE solid;" && # blockquote
s != " border-bottom: none;" && # hr
s != " border-top-width: thin;" && # hr
s != " border-top-style: dotted;" && # hr
s != " border-top-color: #999999;" # hr
) {
cat(s, "\n", file=con)
}
}
close(con)
}