Is there some trick or workaround that allows me to write a code block that starts with a space in reStructuredText? Something like:
This line is indented
This line is not
The naïve attempt:
::
This line is indented
This line is not
obvoiusly doesn't work (the second line is not interpreted as part of the same block. Visually I could obtain the same thing by using a non-breaking space, but then it would affect copy-paste.
Related
I need to indent some math stuff in the \details section of my .Rd documentation to enhance its readability. I am using mathjaxr. Is there any way to indent without installing roxygen2 or similar?
The math stuff is inline, so simply setting to display using \mjdeqn won't solve this.
I seem to have a reasonable "cheating" work around for indenting the first line using mathjaxr, at least for the PDF and HTML output.
We need to do two things:
Use the mathjax/LaTeX phantom command. phantom works by making a box of the size necessary to type-set whatever its argument is, but without actually type-setting anything in the box. For my purposes, if I want to indent, say, about 2 characters wide, I would start the line with a \mjeqn{\phantom{22}}{ } and following with my actual text, possibly including actual mathy bits. If I want an indent of, say, roughly 4 characters wide, I might use \mjeqn{\phantom{2222}}{ }.
Because mathjaxr has a problem with tacking on unsolicited new lines when starting a line with mjeqn, we need to prefix the use of phantom in 1 above with an empty bit of something non-mathjaxr-ish like \emph{}.
Putting it all together, I can indent by about 2 characters using something like this:
\emph{}\mjeqn{\phantom{22}}Here beginneth mine indented line…
I need to explore whether the { } business actually indents for ASCII output, or whether I might accomplish that using or some such.
We are generating a pdf through exams2nops using the items in blocks of choice, we would like to delimitate the blocks in the PDF adding a horizontal line after the last exercise of each block. Having that in mind we added a ***, ---, <hr/> however the behavior was always the same:
I would like a single line without adding the exercise number that's next in the exam:
It is not so easy to solve this by putting the horizontal line into the exercise file. The reason is that the line is needed after the answerlist but the answerlist is not formatted in the exercise but by exams2nops.
A workaround is to tweak the definition of the {question} environment in the LaTeX template used by exams2nops. By default this is simply:
\newenvironment{question}{\item}{}
Where \item is executed at the beginning of the {question} and nothing at the end of it. Changing this by
\renewenvironment{question}{\item}{\hrulefill}
would insert a horizontal line after every question. If you just want it after selected questions you need to insert if/else statements for certain enumerated items. For example, for inserting the horizontal rule after the second item only, you can redefine:
\renewenvironment{question}{\item}{\ifnum\value{enumi}=2 {\hrulefill} \else {} \fi}
Thus, you get the enumi counter from the {enumerate} environment that you use and compare it with 2. If true, you insert the horizontal line, and otherwise you do nothing.
Adding escapes for the backslashes you can pass this re-definition to exams2nops through the header argument:
exams2nops(c("swisscapital", "switzerland", "tstat2", "deriv2"),
header = "\\renewenvironment{question}{\\item}{\\ifnum\\value{enumi}=2 {\\hrulefill} \\else {} \\fi}")
The resulting output is:
I'm trying to italicize (or bold) text in reStructuredText, but after the asterisk, there is not a space. Here's an example:
*function_name*(args)
I want it to look like: function_name(args)
I want function_name to be italicized, but I do not want the parentheses or "args" to be italicized. The problem is that rst does not recognize the closing asterisk because there is no space after this. Any ideas?
I've figured it out, I need to use an escaped space, which will behave like space but will not show up. See here.
So this works:
*function_name*\ (args)
To show up like:
function_name(args)
I have refactored a man page's paragraph so that each sentence is it's own line. When rendering with man ./somefile.3 The output is slightly different.
Let me show an example:
This is line 1. This is line 2.
vs.
This is line 1.
This is line 2.
Are rendering like so:
First:
This is line 1. This is line 2.
Second:
This is line 1. This is line 2.
There is an extra space between the sentences. Note that I have made sure that there is no extra white space. I have more experience with Latex, asciidoc, and markdown and I can control that there, is it possible with troff/groff? I'd like to avoid that if possible. I don't think it should be there.
The troff input standard is to have a newline at the end of each sentence, and to let the typesetter do its job with filling. (Althought I doubt it was the intent, it does make it play nicer with source control.) Therefore, it considers sentence ends to be at the end of a line that ends with a period (or ? or !, and optionally followed by ',",*,],),or †). It also believes that sentences should have two spaces between them. This almost certainly derives from the typography standards at Bell Labs at the time; It's rather curious that this behavior is not settable through any fill modes.
groff does provide a way to set the "inter-sentence" spacing, with the extended .ss request:
.ss word_space_size [sentence_space_size]
Change the size of a space between words. It takes its units as one
twelfth of the space width parameter for the current font. Initially
both the word_space_size and sentence_space_size are 12. In fill mode,
the values specify the minimum distance.
If two arguments are given to the ss request, the second argument sets
the sentence space size. If the second argument is not given, sentence
space size is set to word_space_size. The sentence space size is used
in two circumstances: If the end of a sentence occurs at the end of a
line in fill mode, then both an inter-word space and a sentence space
are added; if two spaces follow the end of a sentence in the middle of
a line, then the second space is a sentence space. If a second
argument is never given to the ss request, the behaviour of UNIX troff
is the same as that exhibited by GNU troff. In GNU troff, as in UNIX
troff, a sentence should always be followed by either a newline or two
spaces.
So you can specify that the "sentence space" should be zero-width by making the request
.ss 12 0
As far as I know, this is a groff extension; heirloom troff supports it, but older dwb derived versions may not.
Example:
This is line 1. This is line 2.
This is line 1. This is line 2.
This is line 1.
This is line 2.
SET SENTENCE SPACING
.ss 12 0
This is line 1. This is line 2.
This is line 1. This is line 2.
This is line 1.
This is line 2.
Results:
$ groff -T ascii spaces.tr |sed -n -e/./p
This is line 1. This is line 2.
This is line 1. This is line 2.
This is line 1. This is line 2.
SET SENTENCE SPACING
This is line 1. This is line 2.
This is line 1. This is line 2.
This is line 1. This is line 2.
So the following will work, but I hope there is a better option.
This is line 1. \
This is line 2.
renders as
This is line 1. This is line 2.
I am trying to use uppertitleback and lowertitleback in lyx (2.0.0)
If I just use uppertitleback and lowertitleback with one line apiece, it works just as expected.
However, if I put any text in between the uppertitleback and lowertitleback, then the entire lowertitleback ends up on the top of the next page.
What I want is the following in lowertitle back:
Copyright Statement
ISBN number
Any suggestions??? (I tried changing my page size back to default, but that didn't make a difference.)
Thank you before I pull out more of my hair!!
It turns out that you need to insert a line break (I used a ragged line break) between each line so it passes it to LaTeX as all one paragraph. Arrrrggghhhh!