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

Adding a tex maths formatted output #3

Closed
janfreyberg opened this issue May 22, 2017 · 6 comments
Closed

Adding a tex maths formatted output #3

janfreyberg opened this issue May 22, 2017 · 6 comments

Comments

@janfreyberg
Copy link

When writing in rmarkdown (to compile to pdf), I prefer my stats reports to be in a tex maths environment. Would it be possible to add this to the package? At the moment, I achieve it with this helper function:

fmt_tex <- function(text){
  return(
    str_replace_all(paste0("$", text, "$"), ', ', '$, $') %>% str_replace_all('petasq', '\\\\eta_p^2'))
)
}

This (at the top) compiles better compared to format='latex' (middle) and `format='markdown' (bottom):
image

@dgromer
Copy link
Owner

dgromer commented Aug 22, 2017

That's what format = "rmarkdown" is for (mind the r). :)

@dgromer dgromer closed this as completed Aug 22, 2017
@janfreyberg
Copy link
Author

Fair enough - you don't think adding the dollar signs to indicate a maths environment is worthwhile? It prevents linebreaks and IMO generally looks better, and also works as mathjax when going to HTML!

I have a solution for this on a fork, will show you once I have it working properly to see if you think it's worth including.

@dgromer dgromer reopened this Aug 24, 2017
@dgromer
Copy link
Owner

dgromer commented Aug 24, 2017

Preventing line breaks is an important point. What do you mean by "and [...] generally looks better"?

Will take a look.

@dgromer
Copy link
Owner

dgromer commented Aug 31, 2017

@janfreyberg could you test format = latex_math and give feedback if this is what you meant? (See commit 30c8c5a)

@janfreyberg
Copy link
Author

@dgromer that looks exactly like what I thought about. Sorry for not getting back to you sooner - was on holiday until now!

By "generally looks better", I meant that it stays consistent across more formats that you can compile to from Rmarkdown, e.g. it will make inline equations look like other latex equations in the document, and as mentioned looks like maths in HTML output.

Thanks for the implementation!

@dgromer
Copy link
Owner

dgromer commented Sep 4, 2017

Thanks for your feedback!

@dgromer dgromer closed this as completed Sep 4, 2017
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