Get rid of \addlinespace in kable

You can add the argument linesep = “” to kable. This will be passed on to kable_latex where it overwrites the default linesep = if (booktabs) c(”, ”, ”, ”, ‘\\addlinespace’) else ‘\\hline’ Example: kable(cars, format = “latex”, booktabs = TRUE, linesep = “”)

Code chunk font size in Rmarkdown with knitr and latex

Picking up the idea to alter a knitr hook we can do the following: def.chunk.hook <- knitr::knit_hooks$get(“chunk”) knitr::knit_hooks$set(chunk = function(x, options) { x <- def.chunk.hook(x, options) ifelse(options$size != “normalsize”, paste0(“\n \\”, options$size,”\n\n”, x, “\n\n \\normalsize”), x) }) This snippet modifies the default chunk hook. It simply checks if the chunk option size is not equal … Read more

Git merging within a line

Here’s a solution in the same vein as sehe’s, with a few changes which hopefully will address your comments: This solution considers merging by sentence rather than by word, as you had been doing by hand, only now, the user will see a single line per paragraph, but git will see paragraphs broken into sentences. … Read more

Latex rendering in README.md on Github

For short expresions and not so fancy math you could use the inline HTML to get your latex rendered math on codecogs and then embed the resulting image. Here an example: – <img src=”https://latex.codecogs.com/gif.latex?O_t=\text { Onset event at time bin } t ” /> – <img src=”https://latex.codecogs.com/gif.latex?s=\text { sensor reading } ” /> – <img … Read more

How to write your own LaTeX preamble in Matplotlib?

When I need to use LaTeX with matplotlib, I add the following to the python script (+ additional commands for debug info) import matplotlib.pyplot as plt plt.rc(‘text’, usetex=True) plt.rc(‘text.latex’, preamble=r’\usepackage{amsmath} \usepackage{foo-name} `…’) matplotlib.verbose.level=”debug-annoying” commands to make your plot here