Skip to content

Commit

Permalink
feat: add function to replace more latex unescaped char
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasoca committed Jan 20, 2023
1 parent 8e124bf commit 4ce891e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkg/generator/latex.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@ import (
)

func replaceUnescapedChar(str string) string {
return strings.ReplaceAll(str, "_", "{\\_}")
s := strings.NewReplacer(
"_", "{\\_}",
"#", "{\\#}",
"%", "{\\%}",
"&", "{\\&}",
"$", "{\\$}",
"{", "{\\{}",
"}", "{\\}}",
)

return s.Replace(str)
}

func createLatexFile(fg FileGenerator) error {
Expand Down

0 comments on commit 4ce891e

Please sign in to comment.