New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Horizontal position adjustment ignores the right margin in PDF #122
Comments
Hi, thanks for this issue. My feeling is that this isn't correct. Take a look at latex.R in the source. You'll see that Really, the whole latex code needs a rewrite from a proper expert. But beware: it is a hairy project to do a truly flexible table in TeX. |
Both
However, setting that to pretty much any value does not help in case of this table. So are you suggesting that that's not a problem of |
Hmm, if you're right that is interesting. So then we have two problems :-). I wouldn't say it's a problem of either hux or TeX on its own. It's how they interact. tabularx is probably not the optimal table package because it demands that you set the width right - and there's no way to do that automatically. tabu might be a better option, but I'm not sure it's supported. A more radical approach would be to drop the ability to do all the things huxtable aims to do (arbitrary per-cell borders, colours, colspan etc.) and just focus on producing simple TeX code for a few key use cases. But that would be a new package.... |
Could you actually put the full code to reproduce here? Thanks. |
This is the full code that I have saved in an .Rmd file:
Then I just knit to PDF. |
Could you try github master? I've just committed some changes to LaTeX. In particular, try with width set and unset; and wrap TRUE and FALSE. There may be new issues, in which case feel free to open them.... |
The particular "right margin" issue mentioned in the title now seems to occur only if width is (wrongly) set. This might happen a lot though. One solution may be to set wrap = TRUE by default. Or, we could allow wrap = NA and then set it to be TRUE or FALSE depending on if width was set. But this would be disruptive and might affect how HTML works. |
Hopefully closed by recent changes. |
This issue arose in the following StackOverflow question: How can you center a huxtable?
As described in the selected answer for the question above, there seems to be an issue with how
huxtable
proccesses (or doesn't) the right page margin. Below, I am showing different options for alignment ("left"
,"right"
, and"center"
, respectively); besides theR code
depicted in the images, each of the following markdown files used to create these PDFs start with the same code (minus the "()"):Left Aligned
Right Aligned
Centered
While the left-aligned table is positioned as expected, the right-aligned one is touching the edge of the page. In the centered table, you can see that the table is essentially centered if the right margin is ignored. This makes me think that this issue is caused by
huxtable
somehow ignoring the right margin.Note that setting margins using
geometry:
in the LaTeX header does not resolve this issue either.The text was updated successfully, but these errors were encountered: