Skip to content
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

Easy halign formatting with borders for LaTeX? #76

Open
ckraner opened this issue Jan 10, 2017 · 4 comments
Open

Easy halign formatting with borders for LaTeX? #76

ckraner opened this issue Jan 10, 2017 · 4 comments

Comments

@ckraner
Copy link

ckraner commented Jan 10, 2017

Is there any way you can simplify using halign for LaTeX printing? Working from your example code, I was able to center the whole column with one line of code:

sprinkle(cols = 2, halign="center") %>%

However, when I looked at the LaTeX code, I noticed this centered the column twice.

\\multicolumn{1}{c}{\\parbox[]{49.5pt}{\\centering -0.39}} &

Now this doesn't effect me running the code at all, but seems redundant. I assume it has to do with the valign height and width options. However, to the request: I was hoping halign could be expanded to use normal latex formatting like |c| to control borders. You already have control to change it to c, and the parboxs and centerings do not hinder this.

@nutterb
Copy link
Owner

nutterb commented Jan 10, 2017

I honestly couldn't tell you what my reasoning here was. Well, I can, actually. It wasn't working...and then I did something...and then it was working. I haven't touched it since :)

But there's certainly room for improvement.

@ckraner
Copy link
Author

ckraner commented Jan 10, 2017

I think the main focus was the parbox. Those seem to be the biggest thing that holds. However, I rescind this request, because I found a work around using the functions you have.

sprinkle(cols = 2, halign= "center", border=c("left","right"), border_thickness=.5, border_color="black")

This originally wouldn't work for me, and it turns out color and colortbl packages were not loaded in my LaTeX! Is this something that pixiedust should do, or should I get in the habit of it?

Also, you should consider changing the defaults for the borders. border_thickness=.5 was very important, otherwise one line would be .5px and the other would be 1px in the setting. In addition, everywhere that I put a line I get an error about Black because in colors it is black, hence why I added border_color="black".

@nutterb
Copy link
Owner

nutterb commented Jan 10, 2017

If I ever learn of a way to inject the LaTeX dependencies from pixiedust, you can be sure I will do that. I haven't researched that much at all, and have depended on my own template that starts with the header that can be copied from http://nutterb.github.io/pixiedust/latex-configuration.html (also in the package documentation). The preamble there has worked well for me.

@ckraner
Copy link
Author

ckraner commented Jan 10, 2017

This fixes the issue with Black. However, IMO the border_thickness is too thick/not the standard border thickness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants