Control inter-paragraph spacing - ms-word

In using OfficeR to generate MS Word documents, is there a means to control how much space appears on the page between paragraphs? Successive calls to body_add_par() insert space between which is too wide for my purpose. I can't find any reference to controlling this in officer.pdf or in the README.
What am I missing?

Inter-paragraph spacing in Word is controlled by the .SpaceBefore and .SpaceAfter settings. For example:
With Selection
With .ParagraphFormat
.SpaceBefore = 6
.SpaceAfter = 6
End With
End With
Ideally, though, you'd apply these to a Style definition (once), then apply that Style to the paragraphs concerned.

Related

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.

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.

Avoid losing format after selecting all text and start typing

We use TinyMCE as the wysiwyg editor for our content builder. You can drag and drop a text module and once you click an edit button an TinyMCE instance will open. This works really well.
Problem is now that the builder is made for designers so a lot of the times you add a text module just for a 1 word heading or other cases where you only have one block. (one h1, one p etc.) You can also see this behavior in the official demos: Just add an lonely h2 heading, select all text and start to write.
Now Tiny MCE has the default behavior that if you select the complete text (which is almost always the case if you for example change an 1 line / word heading) and you start typing you will lose your formats completely. ( in our case: color, font-size, font-weight, line-height etc.)
This makes editing an heading for example really painful. Best workaround so far is to leave 1 character to not lose the format and then delete the character in the end.
I never saw that behavior in other editors so my question is: Is there maybe an easy setting or workaround to avoid this?
If there are situations where you want a root element to be something specific (e.g. <h2>) you can use the forced_root_block setting on that instance of TinyMCE to force a specific element:
https://www.tinymce.com/docs/configure/content-filtering/#forced_root_block
Even if you delete all text the new text will be wrapped with that root element. See this TinyMCE Fiddle for examples:
http://fiddle.tinymce.com/SOfaab
I think this would address your one line issue?

bullet point indenting not working - word 2007

Adjust List Indents function in Microsoft Word 2007 not working once the list goes past 10.
For heading 09 I open the Adjust List Indents function (By right clicking) and set the "Text Indent at" value to .05. This works. However for every heading after 10 following the exact same steps does not work.
This is not an indent issue, its the alignment in your numbering style. Take some time to study this:
http://wordfaqs.mvps.org/NumberAlignment2007.htm#NumberedLists
A related MS Word skill which will leverage your efforts by an order of magnitude is to learn how to define custom List Styles and assign them to custom Paragraph Styles. There is a very good tutorial here:
http://shaunakelly.com/word/numbering/numbering20072010.html
and the analagous bullet list version:
http://shaunakelly.com/word/bullets/controlbullets20072010.html
I would add one level of efficiency to those tutorials:
You don't need to create a Paragraph Style for each list/bullet level. You only need to assign a Paragraph Style to the first level. When the Paragraph Style is applied to text, the List Style will be applied correctly to all levels based on the indentation of the list items.

Eclipse-RCP: Hide lines of text permanently, keep correct line numbers

I have text files which contain code inside an Editor. The user can run an analysis on a certain part of his code, which will result in a set of lines which should be hidden. Next I want to present the user with only the remaining lines, but with correct linenumbers, as from the original document. Possible solutions I thought of:
Open a new Editor which does not contain the hidden lines, but *somehow* still has correct line numbers
Hide the lines in the original editor, and offer a button for the user to 'unhide'. Probably a similar solution required as in 1.
I don't really know how to go about this. Folds would be a weird solution, because they can be unfolded individually, and seem to be more semantically tied to things like methods or classes. Also, simply creating a new document without the hidden lines results in wrong linenumbers.
Use a ProjectionViewer and reflection to invoke the private method ProjectionViewer.collapse(int offset int length). This method is only used internally to hide a certain portion of the text, by manipulating the ProjectionDocument (see http://eclipse.org/articles/Article-Folding-in-Eclipse-Text-Editors/folding.html).
After this, folding text in the editor using the annotations(the little +/- icons) WILL break everything, so this solution and regular folding are mutually exclusive.