> 3. More integration of LaTeX. Maybe a LaTeX function like
gnuplot().
Allin and I weren't sure of what you meant exactly. We thought it might be a
nice idea to introduce a new function that, given a matrix, would return a
string with a complete LaTeX "tabular" environment. Would this be similar to
what you had in mind?
Well, I not too clear myself. Or more accurately, I am not sure what I have in mind could
be put in a single function. Two things would be nice: (1) just as you have stated, a
function that takes a matrix and returns a LaTeX "tabular" environment, but it
should be able to "display" a pdf or save a file with only the tabular block,
i.e. no preamble/begin & end document. (2) A function that can output the results of
any model estimation as a tabular environment or an equation.
Below is an example of a function I wrote to publish the results of a Variance Decomp. It
would be nice not to need to hard code this, but I do not see how you could automate
something like this??? Note: I use a couple of packages including booktab and calc, so
some of the LaTeX code might look weird.
<hansl>
function void FEVDTAB(bundle bARG, matrix matHrzns, string strFileName[null])
strFile = isnull(strFileName) ? "(a)workdir\fevd.tex" : strFileName
outfile "@strFile" --write
string strPeriod
if $pd = 1
strPeriod = "Years"
elif $pd = 4
strPeriod = "Quarters"
elif $pd = 12
strPeriod = "Months"
endif
string strTEMP0
string strTEMP1
string strTEMP2
loop i = 1..cols(matHrzns) --quiet
sprintf strTEMP0 "@strTEMP0c"
sprintf strTEMP1 "@strTEMP1 & %d @strPeriod", matHrzns[i]
sprintf strTEMP2 "@strTEMP2 & Ahead"
end loop
printf "\\begin{tabular}{l@strTEMP0}\n\\addlinespace\n\\toprule\n"
printf "@strTEMP1\\\\\n@strTEMP2\\\\\n\\midrule\n"
strTEMP0 = null
strTEMP1 = null
strTEMP2 = null
scalar intNVAR = bARG["nvar"]
matrix matFEVD = bARG["FEVD"]
matFEVD = matFEVD*100
loop i = 1..intNVAR --quiet
strTEMP0 = bARG["label$i"]
strTEMP2 = strlen(strTEMP2)>strlen(strTEMP0)?strTEMP2:strTEMP0
strTEMP1 = null
loop j = 1..cols(matHrzns) --quiet
sprintf strTEMP0 "@strTEMP0 & %.2f ",
matFEVD[matHrzns[j],(i*3)-2]
sprintf strTEMP1 "@strTEMP1 & (%.2f, %.2f) ",
matFEVD[matHrzns[j],(i*3)-1], matFEVD[matHrzns[j],(i*3)]
end loop
printf "@strTEMP0\\\\\n"
printf "@strTEMP1\\\\\\addlinespace\n"
end loop
strTEMP1 = strsub(strTEMP1, "&", "D")
printf "\\bottomrule\n"
printf "\\multicolumn{%d}{p{\widthof{@strTEMP2@strTEMP1}}}{Note: Numbers in
parentheses are the boundaries of the associated %d percent confidence
interval.}\\\\\n", cols(matHrzns)+1, (1-bARG["alpha"])*100
printf "\\end{tabular}"
outfile "@strFile" --close
end function
</hansl>
Cheers,
Logan