## Create tex file from list

2014-04-11
2014-04-11
• Wolfgang Meiners - 2014-04-11

Hi,
i created a list which contains a whole tex file line by line:

kill(all);

T: [
"\\documentclass{article}",
"\\usepackage[T1]{fontenc}",
"\\usepackage[utf8]{inputenc}",
"",
"\\begin{document}",
"Hello World",
"\\end{document}"
]$map(print,T)$
"\documentclass{article}"
"\usepackage[T1]{fontenc}"
"\usepackage[utf8]{inputenc}"

"\begin{document}"
"Hello World"
"\end{document}"


Now i want to write the list to a tex-file. I tried:

save("/tmp/test.tex",text=map(print,T));
"\documentclass{article}"
"\usepackage[T1]{fontenc}"
"\usepackage[utf8]{inputenc}"

"\begin{document}"
"Hello World"
"\end{document}"


The result is not promising:

;;; -*- Mode: LISP; package:maxima; syntax:common-lisp; -*-
(in-package :maxima)
(DSKSETQ $TEXT '((MLIST SIMP) "\\documentclass{article}" "\\usepackage[T1]{fontenc}" "\\usepackage[utf8]{inputenc}" "" "\\begin{document}" "Hello World" "\\end{document}")) (ADD2LNC '$TEXT \$VALUES)


So how can i write the contents of the List T to a file in a way that latex can process the resulting file? Thank you for any help.

Wolfgang

• Wolfgang Meiners - 2014-04-11

I just found: If i start maxima from terminal then the command

with_stdout("/tmp/test.tex", for i thru length(T) do print(T[i]));


instead of save(...) gives me a valid tex file which can be processed. This does not happen when i use wxmaxima. So this is somehow related to wxmaxima, not to maxima.

Wolfgang