Hi Peter,
just as a hint: A while ago I uploaded the function "latextab" which
writes a matrix as a latex-table. One can also add strings, captions,
labels etc. It is quite flexible and might be helpful.
Best,
Artur
Am 12.04.2016 um 23:30 schrieb Summers, Peter:
Hi all,
I’m trying to write a script that will produce a LaTeX table as output –
basically a customized version of tabprint. Here’s the basic idea:
<hansl>
matrix doh = mnormal(1,3) # this would be a coefficient vector, e.g.
string fmt = "%.4g "
string baz = "doh[1]"
loop i=2..cols(doh) # build up the format and argument strings
fmt ~= " & %.4g "
baz ~= ", doh[$i]"
endloop
fmt
baz
sprintf Foo "\"%s\"\n", fmt
Foo
# this printf is what I want, but I want to use the “fmt” string above
printf "%.4g & %.4g & %.4g\n", @baz
# this seems like it should work, but I get a “syntax error”
sprintf bar Foo, @baz
</hansl>
I’m still trying to get my head around (s)printf, string substitution,
etc., so I’m probably missing something straightforward. Any suggestions
welcome!
Thanks,
PS
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users