How to increase line spacing in the editor?

Hi,

I am a researcher and use RMarkdown files to analyze my data and write manuscripts all in one reproducible file (which is absolutely great!). However, I wonder if there is a way to increase line spacing in my Rmarkdown documents (in RStudio's editor window, not the knitted document)? This would help me (re-)reading and writing text a lot! Preferably, it would be nice to have increased line spacing in RMarkdown text but unchanged lines spacing inside the code chunks.
I am aware that you can change the appearance of the IDE by modifying the underlying CSS file (e.g., according to this tutorial). However, I was not able to identify the CSS selector that allows to modify line spacing. Any help would highly appreciated.

I don't know if this will help directly, but here's the repository with all the built-in themes for the Ace editor (what RStudio uses under the hood): https://github.com/ajaxorg/ace/tree/master/lib/ace/theme Might be a better starting point for making a new theme of your own? Many of these were converted from .tmtheme files.

Playing around with the Ace "kitchen sink" demo with the Markdown sample text, I can change the line-height everywhere by setting line-height on the overall .ace-themename class, but I couldn't immediately see a simple way to change it back to something smaller for code chunks.

1 Like

Thank you very much for pointing out the Ace editor! I'll give it a try... However, it looks like my ultimate goal (different line spacing for different types of Rmarkdown elements, i.e. code vs. markdown) is not that easy to achieve (especially given my limited CSS skills). I wonder if this could be a possible feature request for RStudio. However, I don't know if this is a relevant issue and if others would appreciate such a feature.

I'm not directly answering your question, but something I recently found helped me with reading my Rmarkdown was clicking the 'show whitespace characters` box in under Tools > Global Options > Code > Display

I particularly found this helpful when using the bookdown package where leaving whitespace at the end of a figure reference means it doesn't build properly, but I've left it on all the time as I find it guides my eye and makes it easier to see what's going on.

2 Likes

Find line-height parametre using "Inspect" and change it.

Inherited parametre value is 1.2 by default. If you change the value in Inherited from div#rstudio_source_text_editor (or Inherited from td, not sure), it will affect line hight for all panes.

Unfortunately, I couldn't find how to change the hight only for the editor, so I've changed the value for all panes, and then set it for Console and Files panes separately.

I hope, the screenshot will illustrate the process!

console_line_height_wcomment|690x413