In orgmode ASCII export, omit blank lines between items in list - org-mode

Consider the following:
#+OPTIONS: num:nil toc:nil
#+AUTHOR:
* h1
** h2
*** h3
**** item 1
**** item 2
**** item 3
When using ASCII export, orgmode renders that as:
h1
==
h2
~~
h3
--
* item 1
* item 2
* item 3
I don't like all of the blank lines (or empty lines, or newlines) between the itemized list items. I would prefer it to render as:
h1
==
h2
~~
h3
--
* item 1
* item 2
* item 3
How do I accomplish that?

Probably the simplest way is to customize org-ascii-headline-spacing and set it to nil. That will make the spacing of the output mirror the spacing of the input, so you can set it exactly as you want
The doc string of org-ascii-headline-spacing says:
Number of blank lines inserted around headlines.
This variable can be set to a cons cell. In that case, its car
represents the number of blank lines present before headline
contents whereas its cdr reflects the number of blank lines after
contents.
A nil value replicates the number of blank lines found in the
original Org buffer at the same place.

Related

How to change unnest cell array into a lined up formation?

I have the following 2 x 1 cell C
Text1
Text2
And I wanted to write out this in the following line up and store it in the Variable Container:
Container = {'Text';'Text2'};
a.)Is there a command which leds me write out this desired line up (including the brackets as well as the semicolons)?
b.)How can expand this little example for more than 2 rows?
If you need the text representation of the cell array you can use strjoin:
Container = ['{''' strjoin(C, ''';''') '''}'];
It is assumed that the cell array contains only character strings and it isn't empty.

Inserting blank spaces at the end of a column name in a table using pander

I am trying to find a way of centering a column heading in a pander table using knitr to pdf in rmarkdwon, but keeping the column entries right justified.
---
title: "Table Doc"
output: pdf_document
---
```{r table, echo = FALSE}
table1 <- anova(lm(Petal.Length ~ Species*Petal.Width, iris))
names(table1) <- c("DF", "Sum Sq", "Mean Sq", "*F*", "*p*")
library(pander)
pander(table1, justify = c("left", rep("right", 5)))
```
There is no way to align individual cells inside a table in pandoc apparently. I want the entries to be to the right so they are all aligned properly but sit the column headings 'F' and 'p' in the center. So what I need to do is insert blank spaces after F and p to force them into the center. How do I do this? I tried simply inserting the blank spaces:
names(table1) <- c("DF", "Sum Sq", "Mean Sq", "*F* ", "*p* ")
but the spaces are not recognised by pander.
I also tried LaTex spacing characters
names(table1) <- c("DF", "Sum Sq", "Mean Sq", "*F*\\", "*p*\\")
but this didn't work either. Can anyone think of a workaround?

Applescript to resort piles of numbers

I'm trying to resort a bunch of numbers with Applescript. I'm very new to the language and I thought I'd ask you for help.
I have a group of numbers which looks like this in my TextEdit file:
v 0.186472 0.578063 1.566364
v -0.186472 0.578063 1.566364
v 0.335649 0.578063 1.771483
What i need is a script that resorts these numbers, making it appear like this:
(0.186472, 0.578063, 1.566364),
(-0.186472, 0.578063, 1.566364),
(0.335649, 0.578063, 1.771483),
So after each number, there has to be a comma, and always the three numbers on one line have to be put into brackets (). finally there has to be another comma after every bracketed group of three and the v before every line has to be deleted.
I've only so far managed to get rid of every "v" using:
set stringToFind to "v"
set stringToReplace to ""
But now im stuck and I'm hoping for help.
To find and replace strings in AppleScript the native way is using text item delimiters. There are a fixed number of values separated by spaces (or tabs) on each line, using text item delimiters, text itemsand string concatenation we can solve your problem.
I've added an addition linefeed in front and at the back of the string to show that lines that doesn't contain 4 words are ignored.
set theString to "
v 0.186472 0.578063 1.566364
v -0.186472 0.578063 1.566364
v 0.335649 0.578063 1.771483
"
set theLines to paragraphs of theString
set oldTIDs to AppleScript's text item delimiters
repeat with i from 1 to count theLines
set AppleScript's text item delimiters to {space, tab}
if (count of text items of item i of theLines) = 4 then
set theNumbers to text items 2 thru -1 of item i of theLines
set AppleScript's text item delimiters to ", "
set item i of theLines to "(" & (theNumbers as string) & "),"
else
set item i of theLines to missing value
end if
end repeat
set theLines to text of theLines
set AppleScript's text item delimiters to linefeed
set newString to theLines as string
set AppleScript's text item delimiters to oldTIDs
return newString

How to efficiently transpose rows into columns in Vim?

I have a data file like the following:
----------------------------
a b c d e .............
A B C D E .............
----------------------------
But I want it to be in the following format:
----------------------------
a A
b B
c C
d D
e E
...
...
----------------------------
What is the quickest way to do the transformation in Vim or Perl?
Basically :.s/ /SpaceCtrl+vEnter/gEnterjma:.s/ /Ctrl+vEnter/gEnterCtrl+v'axgg$p'adG will do the trick. :)
OK, let's break that down:
:.s/ /Ctrl+vEnter/gEnter: On the current line (.), substitute (s) spaces (/ /) with a space followed by a carriage return (SpaceCtrl+vEnter/), in all positions (g). The cursor should now be on the last letter's line (e in the example).
j: Go one line down (to A B C D E).
ma: Set mark a to the current position... because we want to refer to this position later.
:.s/ /Ctrl+vEnter/gEnter: Do the same substitution as above, but without the Space. The cursor should now be on the last letter's line (E in the example).
Ctrl+v'a: Select from the current cursor position (E) to mark a (that we set in step 3 above), using the block select.
x: Cut the selection (into the " register).
gg: Move the cursor to the first line.
$: Move the cursor to the end of the line.
p: Paste the previously cut text after the cursor position.
'a: Move the cursor to the a mark (set in step 3).
dG: Delete everything (the empty lines left at the bottom) from the cursor position to the end of the file.
P.S. I was hoping to learn about a "built-in" solution, but until such time...
Simple re-map of the columns:
use strict;
use warnings;
my #a = map [ split ], <>; # split each line on whitespace and store in array
for (0 .. $#{$a[0]}) { # for each such array element
printf "%s %s\n", $a[0]->[$_], $a[1]->[$_]; # print elements in order
}
Usage:
perl script.pl input.txt
Assuming that the cursor is on the first of the two lines, I would use
the command
:s/ /\r/g|+&&|'[-;1,g/^/''+m.|-j

Displaying text from two fields, separated by a varying number of "." symbols, while preserving the total string length

I'm trying to create a Table of Contents for a small publication using Filemaker 10, since that's what the data has been stored in previously.
I'm able to generate page numbers, add heading to the TOC and pretty much everything else I've needed to do - one thing withstanding.
Our designer wants to fill each TOC line with "." to make it easier to read.
Currently:
Using Stack Overflow 1
Why Reddit is better than digg 7
Does Filemaker really suck this much 84
Ways to convince bosses 92
Ditching FileMaker 97
Wanted:
Using Stack Overflow..................................................1
Why Reddit is better than digg........................................7
Does Filemaker really suck this much.................................84
Ways to convince bosses..............................................92
Ditching FileMaker...................................................97
The item and page number are in different fields. Using a border is unsatisfactory because it underlines everything.
Solutions?
You can do this using tab stops in the Format -> Text menu
1) Create a calc field with the following definition (the character in the quotes is a tab):
title & " " & page
2) Add this field to your layout (it needs to be an actual field, not a merge field)
3) Highlight the field and choose format -> text -> paragraph -> tabs
4) Create a new Tab with a position of 6 inches and a Fill Character of "." or "…"
Now when viewed, any space from the end of the title up to the tab stop 6 inches away is filled with the fill character. No monospace font required.
You need to break it up into bits and then put it back with the right spacing. Something like this would do :
Let ( [
text = "Why Reddit is better than digg........................................7" ;
len = Length ( text ) ;
end = RightWords ( text ; 1 ) ;
lenEnd = Length ( end ) ;
lenStart = Length ( Trim ( Right ( text ; len - lenEnd ) ) ) ] ;
Left ( text ; lenStart ) &
Left ( "..........................................................................." ; len - lenStart - lenEnd ) &
end )
I've built the "text" variable into the calc for testing, but you could do this as a Custom Function or just inside a calculation with the field instead.
Also this assumes you're using a mono spaced font and the gap in the middle is a space character.