This commit is contained in:
lukas 2021-09-11 23:26:06 +02:00
parent 2c31c930ec
commit c65e889519

24
Main.go
View File

@ -119,11 +119,13 @@ func compileLatex() (*string, error) {
argsWithoutProg = argsWithoutProg[:len(argsWithoutProg)-1] argsWithoutProg = argsWithoutProg[:len(argsWithoutProg)-1]
} }
addArgIfNotExisting(&argsWithoutProg, "-interaction", "-interaction=nonstopmode")
addArgIfNotExisting(&argsWithoutProg, "-synctex", "-synctex=1")
addArgIfNotExisting(&argsWithoutProg, "-ouput-format", "-output-format=pdf")
addArgIfNotExisting(&argsWithoutProg, "-file-line-error", "-file-line-error")
// insert default args // insert default args
argsWithoutProg = append(argsWithoutProg, "-file-line-error", argsWithoutProg = append(argsWithoutProg, filename)
"-interaction=nonstopmode",
"-synctex=1",
"-output-format=pdf", filename)
cmd := exec.Command(app, argsWithoutProg...) cmd := exec.Command(app, argsWithoutProg...)
stdout, _ := cmd.StdoutPipe() stdout, _ := cmd.StdoutPipe()
@ -158,6 +160,20 @@ func compileLatex() (*string, error) {
return &output, err return &output, err
} }
func addArgIfNotExisting(args *[]string, searchstring string, arg string) {
exists := false
for _, s := range *args {
if strings.Contains(s, searchstring) {
exists = true
}
}
if !exists {
tmp := append(*args, arg)
*args = tmp
}
}
var i = 0 var i = 0
// printPoint print a point with every 10th method call // printPoint print a point with every 10th method call