summary refs log tree commit diff stats
path: root/tools
diff options
context:
space:
mode:
authorAndrey Makarov <ph.makarov@gmail.com>2021-06-01 21:47:23 +0300
committerGitHub <noreply@github.com>2021-06-01 20:47:23 +0200
commitba3ec7b04954a9a60adb6e1a64405f7644f799ee (patch)
treefb3a4f82dda1d12001b9a918b4546c0e386b8e78 /tools
parentc2e3dc0ed16a854981769b426e9e327663447df7 (diff)
downloadNim-ba3ec7b04954a9a60adb6e1a64405f7644f799ee.tar.gz
docs: Latex generation improvements (#18141)
* docs: improve Latex generation

* make it work on Windows + fix ] escaping

* minor fixes with escapes and style
Diffstat (limited to 'tools')
-rw-r--r--tools/kochdocs.nim14
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/kochdocs.nim b/tools/kochdocs.nim
index 621dc643f..f25564fad 100644
--- a/tools/kochdocs.nim
+++ b/tools/kochdocs.nim
@@ -284,22 +284,22 @@ proc buildDoc(nimArgs, destPath: string) =
 
 proc nim2pdf(src: string, dst: string, nimArgs: string) =
   # xxx expose as a `nim` command or in some other reusable way.
-  let outDir = "build" / "pdflatextmp" # xxx factor pending https://github.com/timotheecour/Nim/issues/616
+  let outDir = "build" / "xelatextmp" # xxx factor pending https://github.com/timotheecour/Nim/issues/616
   # note: this will generate temporary files in gitignored `outDir`: aux toc log out tex
   exec("$# rst2tex $# --outdir:$# $#" % [findNim().quoteShell(), nimArgs, outDir.quoteShell, src.quoteShell])
   let texFile = outDir / src.lastPathPart.changeFileExt("tex")
-  for i in 0..<2: # call LaTeX twice to get cross references right:
-    let pdflatexLog = outDir / "pdflatex.log"
+  for i in 0..<3: # call LaTeX three times to get cross references right:
+    let xelatexLog = outDir / "xelatex.log"
     # `>` should work on windows, if not, we can use `execCmdEx`
-    let cmd = "pdflatex -interaction=nonstopmode -output-directory=$# $# > $#" % [outDir.quoteShell, texFile.quoteShell, pdflatexLog.quoteShell]
-    exec(cmd) # on error, user can inspect `pdflatexLog`
+    let cmd = "xelatex -interaction=nonstopmode -output-directory=$# $# > $#" % [outDir.quoteShell, texFile.quoteShell, xelatexLog.quoteShell]
+    exec(cmd) # on error, user can inspect `xelatexLog`
   moveFile(texFile.changeFileExt("pdf"), dst)
 
 proc buildPdfDoc*(nimArgs, destPath: string) =
   var pdfList: seq[string]
   createDir(destPath)
-  if os.execShellCmd("pdflatex -version") != 0:
-    doAssert false, "pdflatex not found" # or, raise an exception
+  if os.execShellCmd("xelatex -version") != 0:
+    doAssert false, "xelatex not found" # or, raise an exception
   else:
     for src in items(rstPdfList):
       let dst = destPath / src.lastPathPart.changeFileExt("pdf")