Grid arrange title italics - titlebar

Hello All I'm trying to figure out how to get italicize one word in my grid arrange title. I've tried the bquote approach, but it won't graph the title. Thanks!
full_title <- bquote(paste(italic(Tamarix),"Green Foliage %"))
grid.arrange(Dry_16, Dry_17, nrow=1, ncol=2,top=full_title)

library(gridExtra)
full_title <- expression(italic(Tamarix)~"Green Foliage %")
rg <- grid::rectGrob()
grid.arrange(rg, rg, ncol=2,top=full_title)

Related

How to get a dot over a symbol in gnuplot?

I am trying to create a plot in gnuplot with dots over the symbol theta in legend.
I am looking to do something similar to, \dot{\theta} and \ddot{\theta} from latex. However, most posts ask to use 'set term latex' or 'set term epslatex' which outputs a .tex file. I need to keep the output as a pdf with the dot and double dot over the theta in the legend. Is this possible? Appreciate any help. Thanks!
In place of 'Pitch rate', I need the symbol theta with a dot above it.
In place of 'Pitch acceleration', I need the symbol theta with two dots above it.
set term pdf
set termopt enhanced
set encoding utf8
set output "rampfuncs.pdf"
set style func linespoints
set xlabel 'time'
set format y "%.2f"
plot "output.dat" using 1:2 title '{/Symbol q} - Pitch angle', \
"output.dat" using 1:3 title 'Pitch rate', \
"output.dat" using 1:4 title 'Pitch acceleration'
set term x11
Update after answer from meuh: Image for reference
Second update after comments from meuh: Image 2
This is described in the section Enhanced text mode of the gnuplot guide. You can use the ~ tilde character to overprint two items, for example ~a/ will overprint a and /. In your case you need to raise the dot character by 1.1 times the font size (found empirically) in order for it to appear above the a so you prefix the character with this number, and enclose it in braces to make it one item: ~a{1.1.}
plot "data" using 1:2 title '{/Symbol q} angle', \
"data" using 1:3 title '~{/Symbol q}{1.1.} rate', \
"data" using 1:4 title '~{/Symbol q}{1.1..} accel'
which gives this result:
There seems to be a bug where the title will not be shown correctly if the ~{}{} construct is at the end of the title. The simple workaround is to add an extra space at the end of the title ~{}{} .

iText spacing inbetween paragraph

managerp4.add(Chunk.NEWLINE);
managerp4.add(managerVO.getManagerAddress().getRoad2());
managerp4.add(Chunk.NEWLINE);
managerp4.add(managerVO.getManagerAddress().getRoad3());
This will generate output in newline like this
Road 2
Road 3
but i want to display in same line with space between two values
you can use the method com.itextpdf.text.Paragraph.setSpacingAfter(float) as follows:
Example
Paragraph p = new Paragraph("This a string");
p.setSpacingAfter(10);

extracting runs of text with Mechanize/Nokogiri

Is there a sensible way to extract each run of text in a Mechanize-parsed HTML document, so that (for example):
<p>Here is <b>some</b> text<p>
is broken into three elements:
Here is
some
text
? My hunch is that there's a simple technique using recursive CSS search and/or #flatten, but I've not figured it out yet.
Borrowing from an answer in "Nokogiri recursively get all children":
result = []
doc.traverse { |node| result << node.text if node.text? }
That should give you the array ["Here is ", "some", " text"].
"Getting Mugged by Nokogiri" discusses traverse.
Since you want the contents of each text node, you can do this:
doc.search('//text()').map(&:text)
The only downside to this (and to the other answer) is that you get all the whitespace between elements as well. If you want to suppress this, you can do this:
doc.search('//text()').map(&:text).delete_if{|x| x !~ /\w/}
This removes all elements that don't contain a word character.

How do I remove newlines from a String in Dart?

How do I remove the newlines from a string in Dart?
For instance, I want to convert:
"hello\nworld"
to
"hello world"
You can use replaceAll(pattern, replacement):
main() {
var multiline = "hello\nworld";
var singleline = multiline.replaceAll("\n", " ");
print(singleline);
}
#SethLadd's answer is correct, but in a very basic example.
In the case of a multiline input with text like:
Hello, world!
{\n}
I like things:
- cats
- dogs
{\n}
I like cats, alot
{\n}
{\n}
and more cats
{\n}
{\n}
{\n}
. (ignore this dot)
In the case of the above, your string is represented like this:
Hello, world!\n\nI like things:\n- cats\n- dogs\n\nI like cats, alot\n\n\nand more cats\n\n\n\n
Using #SethLadd's solution, I will be left with:
Hello, world!I like things:- cats- dogsI like cats, alotand more cats
which is certainly not the desired outcome. I suggest using the commonly used regex approach of to tackle the problem.
Calling .trim() will remove the last 4 \n (and any \n infront too).
If one wishes, you could limit new lines to a single open line with something like
text.trim().replaceAll(RegExp(r'(\n){3,}'), "\n\n")

How can I attach a LaTeX marker to an arbitrary place in text?

Is it possible to attach a marker to just a place in text, not to section, sub-section, etc.?
This is what I'm trying to achieve:
\begin{document}
Alex (see~\ref{alex}) is a boy,
Jessica (see~\ref{jessica}) is a girl.
[...]
\label{alex}\ref{alex}: Alex Johnson: 4 y.o.
\label{jessica}\ref{jessica}: Jessica D.: 5 y.o.
\end{document}
I want to get something like this:
Alex (see 1) is a boy,
Jessica (see 2) is a girl.
[...]
1: Alex Johnson: 4 y.o.
2: Jessica D.: 5 y.o.
Makes sense?
This is the solution:
\newcounter{foo}
Alex (see~\ref{alex}) is a boy,
Jessica (see~\ref{jessica}) is a girl.
[...]
\refstepcounter{foo}\thefoo\label{alex}: Alex Johnson: 4 y.o.
\refstepcounter{foo}\thefoo\label{jessica}: Jessica D.: 5 y.o.
Posted by Will at https://tex.stackexchange.com/questions/4021/how-to-set-a-marker-counter-label-to-an-arbitrary-piece-of-text
If you want to have a label, consider the following (from here);
\label{marker} You give the object you want to reference a marker, you can see it like a name.
\ref{marker} You can reference the object you have marked before. This prints the number that was assigned to the object.
\pageref{marker} It will print the number of the page where the object is.
Normally, if you reference to a label, LaTeX prints out the section, subsection, etc. But if you want to specify the exact place in text, you can use pageref. So with pageref you can exactly print out the page number of the "marker".
This is - as far as i know - the most exact possibility to tell the reader where in text a "marker" was, i.e. it is - as far as i know - impossible to tell LaTeX to print the exact line number or so.
You can use \label anywhere, including in the body of the text, but the thing labelled will be (roughly) the 'current labellable thing', that is the last \*section, or the current equation or table.
If you want to label something else (what is it you're after?) then you'll have to roll your own (not trivial), and have something which, if I recall correctly, sets \#currentlabel.
Edited, to add:
\begin{document}
\section{Hello}
Here is some text
\label{l1}
More text.
\newpage
Further text, on page 2
\label{l2}
This is section~\ref{l1} on page~\pageref{l1}.
And section~\ref{l2} on page~\pageref{l2}.
\end{document}
In both cases, the \ref refers to section 1, though the \pageref refers to pages 1 and 2 respectively. In both cases, the 'thing being labelled' is the section, and the text that goes in the label, and which appears in the \ref, is the section number.
So if you want to refer to an 'arbitrary place in the text', you have to ask yourself 'what is the text that would be produced by the \ref?'

Resources