The texreg
package is supposed to write tables with nicely aligned columns, using the command dcolumn = TRUE
, see the user's guide for the texreg
package, dated 3 March 2018. The command calls the dcolumn
package, but dcolumn
is not available for the current version of R (see earlier post).
Without alignment, tables generated by texreg
do not look good in a PDF document compiled with knitr
. (The knitr
package uses the Times New Roman font family for PDF, not monospaced font.) One (not optimal) solution might be to change the font in the whole PDF to monospace. I have found no reference to changing the font family in the knitr
documentation, but a post here at SO discusses it. I had no success using the suggested solution. It would anyway not be a great solution to use monospace font throughout a document that combines text and code.
So, how should users of texreg
make sure tables in a document knitted to PDF have aligned columns in a table?
This question is very similar to an earlier post, but no suggestion was provided to the earlier question. It is probably important for most users of texreg
to have a solution for aligning table columns after the dcolumn
package has become outdated.