Difference between ERT and LyX' custom knitr insets - knitr

What's the difference, if any, in terms of control, between using ERTs, as in the minimal example, and using, instead, LyX' own Custom Insets (Chunk, S/R expression, Sweave options) for knitr?
I've replicated the "minimal" examples, using also the Options inset inside a Chunk inset, and I can see no differences. (I am still ignorant on how to use the Sweave options inset.)

There are currently only small differences. Using the chunk inset takes a bit more time, unless you set up shortcuts, because you have to insert the inset, then insert the options. The main advantages are simply that it is marked as a chunk, and you do not have to manually enter "<<>>=" and "#". Sometimes I forget whether it is "<>=" and sometimes I forget the equals sign so this is nice for my bad memory. If you want to get fancy, you can customize the font size and color within the chunk inset (you could do this for ERT also but that would apply for all ERTs, not just knitr chunks). If interested, see Help > Customization in LyX.
We hope to implement some features that might enhance the use of chunk insets over ERT. For example, it would be nice to navigate chunk insets in the outline pane. This is http://www.lyx.org/trac/ticket/7790
It would also be nice to ensure that knitr chunks start and end with newlines. This would prevent some not-so-rare problems. This is http://www.lyx.org/trac/ticket/8875
It comes down to a matter of preference. I prefer the chunk inset, but note that the author of knitr prefers ERT.

Related

Display larger indentation for files that are indented with just two spaces

I'm working on a project that is using 2 spaces as indentation.
I have a hard time reading code with such small indentation, so my question is:
Question: Can I make vscode show the two spaces as if they were wider (for example double the width)?
(I could of course solve it in a hackish way, by converting each file on checkout, and convert it back before i commit it, but that would be very tedious and error prone. I could also try to convince the project to convert the whole project to tabs, so that everyone can use their own preferred indentation. But I don't want to go into that discussion for every project I work on :) )
I have written the extension Indent Whitespace that decorates each space used in indentation with additional spaces (cursor will skip the decoration).
The decorated spaces are colored with a very transparent red.
With a setting you can change the number of spaces to add, default 1.
If you delete spaces with Delete it looks funny because the selection does not change, use the Arrow keys to update the decorations.
In a later version I will make the decoration color a setting, and also only update the decoration when the file changes (only important for large files, and fix the delete-update rendering).
I think you can't.
There is no such setting in VS Code. As of version 1.13, you can change the kerning, but this changes the spacing between all characters. You cannot do this only for a single character (or a set of characters).
The space width is a property of the font. Microsoft has a guideline that defines what is the ideal space size for a font. But this does not mean you cannot change it yourself when designing one. So I created a version of Roboto Mono which space character is 4x the original one.
This works on Notepad and MS Word, we can see the space is quite big. However, using the exact same font in VS Code, the space is still small, independently of the font being monospaced or not.
Illustration
Somehow, it looks like VS Code ignores space size in the font and decides by itself what is the best value.

Fillable Pdf multi-line, Allow rich text formatting in Acrobat Pro DC: but it ignores line spacing/leading set in More

I'm on Win10, using Acrobat Pro DC 2021.011... to edit and Reader DC (same version) to test.
From experience and from reading forums etc, forms in these apps are maddening... but I have not been able to find any discussion (or solutions) to the following behavior...
The form I'm building for other employees' use has a large edit text box set to Multi-line and Allow Rich Text Formatting. It is set to a default font, Calibri and size 50pt. For most situations this will work for them; provides 2-3 lines for a short product description. But occasionally they want a smaller font and more lines... They know how to get the ctrl+e properties bar. But in my testing of this alternative situation they'll need sometimes, I'm finding it's impossible to get the smaller font size and more lines to work. Here's my process.
tab into text box. Ctrl+E for properties bar.
before typing I set the font size to 24
then I type in my 4 lines of text
then I tab to my next form field...
and kaboom... the field I just filled...it's line height is so large it's pushed some of the content invisible. I assume this is coming from the field's default font size, 50
And if I try to adjust the line height, by selecting all the text and then choosing in More...>Form Field Text Properties>Paragraph>Line Spacing
If I set it to Single and click Close/click into another field I get the very large leading (presumably for 50pt font (same as pic above after point 5)
If I choose Exactly and set to point size slightly larger, click Close/out of field, I get another ridiculous result where the 2/3 line have the height I set, but the space between the 1 & 2 second line is way too much and the space between the last line and 3rd line is way too small...
before tabbing or clicking out of field to another field
Good lord.. what is that! 3 different leading values in the same field; just after applying 1 value to all lines, all text in the field...
It makes no sense... it doesn't look like it regards your input at all, and just comes up with it's own random leading... I've fiddled with Space before/after and combinations of Line Height and nothing comes close to what we need... At this point I'm convinced the Acrobat tools for a stylizing text in a multi-line, allow formatting text field are useless. I'd be better off with my employees they can't format anything, ever. Just type one line and hit Tab or Enter...
What is going on! I'm trying to make a simple fillable form for other employees to use, but this kind of behavior makes that impossible (It's enough of a stretch to teach them to use the ctrl+E and do some styling of their text but this is bonkers and completely unteachable... there's not rhyme or pattern to teach!)
Hope someone can help or has seen this behavior too.

How to insert keyboard key graphic representations into your document?

I'm working on a document describing keyboard shortcuts in GNOME and want to make text better looking than: ALT + TAB. A common way seems to be like in this thread where the buttons appear to be within the text:
https://unix.stackexchange.com/q/465681
Is this possible in LibreOffice in a proper way, or is it just inserting images inline? That doesn't seem like it would work every well with changing font size, etc. later, so I was hoping for a better solution.
You could insert real push buttons that don't do anything by following steps 1 thru 6 outlined at https://help.libreoffice.org/Common/Inserting_and_Editing_Buttons. But that approach, as well as inserting inline images, would be awkward because you'd have to worry at least about sizing, anchoring, and wrapping of surrounding text.
The approach you appear to be trying to avoid seems much more palatable, so long as you're not looking to exactly duplicate to Stack Exchange look.
As an example to demonstrate that it's workable, I did the following by applying the same Character formatting settings to each key word. This involved changing font family and size, setting light gray highlighting, adding a gray border, and changing left and right border padding from 0.02 to 0.06...
To make things easy, the settings could all be done with a single button press by creating a macro that could be applied to selected text. And since the result is just formatted text, there are no sizing, anchoring, or text wrapping issues to worry about.
One other option, as an alternative to significant text formatting, is to acquire and use a keyboard font, such as that discussed at How is the Keyboard font automatically styled as keyboard-like keys for the letters in Alt, Shift, Ctrl, Esc, and Backspace?. That would only require changing to that font to type in key representations.

Getting rid of figure captions under figures

This is for Papaja. How do I get rid of figure captions at the bottom of the figure. My figure caption is quite long and I am going to a figure list. Now, I get both, and the figure caption runs out on the bottom of the page. Thanks, Jeff
There are currently two options to accomodate long figure captions or tall figures. You can adjust the line spacing/font size or, as you are doing, use a separate list of figure captions. I'll briefly explain both approaches.
1. List of figure captions
a) The LaTeX way
You can suppress the captions (defined by the chunk option fig.cap) below all figures by adding the following to the YAML front matter:
figurelist: yes
header-includes:
- \captionsetup[figure]{textformat=empty}
b) The knitr way
If you would rather suppress figure captions only where necessary you can instead get knitr to do this.
Set the figure short caption via the chunk option fig.scap. To ensure that fig.scap takes effect, knitr requires that the chunk specifies out.width, out.height, or fig.align, as explained here. Remove the figure caption below the figure by setting fig.cap = " ".
Finally, I generally recommend to specify figure (and table) captions, especially long ones, using text references (e.g., (ref:reference-label). Taking all of this together, the following should do the trick:
(ref:figure-caption) This is a long figure caption!
```{r fig.cap = " ", fig.scap = "(ref:figure-caption)", out.width = "\\textwidth", fig.height = 7}
plot(cars)
```
Make sure that you include figurelist: yes in the YAML front matter and that you are using at least the development version of papaja with the commit hash d6227d8a750c6e67a323828a7cb0b8b8331aeac7, e.g. devtools::install_github("crsh/papaja#d6227d8a750c6e67a323828a7cb0b8b8331aeac7").
2. Adjust line spacing and font size
As mentioned in the manual, you can adjust the line spacing of figure captions. To additionally decrease the font size, add the following to the YAML front matter:
header-includes:
- \usepackage{setspace}
- \captionsetup[figure]{font={stretch=1,scriptsize}}
This should also make room for bigger captions or taller figures.

Wrapping variable width text in Emacs Lisp

I am hacking up a tagging application for emacs. I have got a tag cloud/weighted list successfully displaying on a buffer, but i am running into a snag. I need to be able to properly word-wrap the buffer, but I haven't a clue where to start.
The font I am using is a variable width font. On top of that, each tag is going to be in a different size, depending on how many times it shows up on the buffer. Finally, the window that displays the tagcloud could be in a window that is 200 pixels wide, or the full screen width.
I really have no idea where to start. I tried longlines mode on the tagcloud buffer, but that didn't work.
Source code is at: http://emacswiki.org/cgi-bin/emacs/free-tagging.el
You probably want to track posn-at-point and posn-at-x-y as you put the tags in the buffer.
Can you use (fill-paragraph) or (fill-region) or similar? They wrap at a column, so don't have variable width font smarts, but if the fill column is low they might work for next to no effort. At least until you get a pixel-perfect solution sorted out :-) (maybe YAGNI...)