[R] display double dot over character in plotmath?
David Winsemius
dwinsemius at comcast.net
Sun May 14 19:43:07 CEST 2017
> On May 14, 2017, at 9:08 AM, David Winsemius <dwinsemius at comcast.net> wrote:
>
>>
>> On May 14, 2017, at 8:43 AM, Ranjan Maitra <maitra at email.com> wrote:
>>
>> Thanks, Duncan!
>>
>> This works for the particular case and is, to my mind, a great solution!
>>
>> However, I was wondering: is it possible to use these double dots with another character, such as omega?
>>
>> I apologize for changing the question somewhat, but I did not realize earlier that there were separate codes for putting double dots over different letters and I thought that figuring out the simpler question would be enough for me to figure out the next step.
>
> I think you should be looking for a LaTeX solution. There is a tikzDevice-package.
>
> This says you can assemble symbols with backspaces:
>
> https://www.stat.berkeley.edu/~partha/symbols.pdf
>
> For instance, LATEX defines \hbar (“~”) as a “¯” character (\mathchar’26) followed by a backspace of 9 math units (\mkern-9mu), followed by the letter “h”:
>
> The second example in ?tikz, which could be a starting point for completing your task fails on my Mac by only displaying the names of the glyphs but not the glyphs themselves in the plot, but it might have a better chance of succeeding on a Linux box.
I'm not having a lot of success finding a "naked umlaut" with which I can backspace to put above a capital \Omega but I found and answer on how to use Newtonian differentiation notation in LateX:
https://tex.stackexchange.com/questions/152951/how-to-write-two-dot-above-a-letter
So this now produces the desire results, thanks to Kirill Müller <krlmlr+r at mailbox.org> tikzDevice package:
#-----------
library(tikzDevice)
options(tikzMetricPackages = c("\\usepackage[utf8]{inputenc}",
"\\usepackage[T1]{fontenc}", "\\usetikzlibrary{calc}",
"\\usepackage{amssymb}"))
tikz("formula.tex", width = 4, height = 4, standAlone = TRUE,
packages = c("\\usepackage{tikz}",
"\\usepackage[active,tightpage,psfixbb]{preview}",
"\\PreviewEnvironment{pgfpicture}",
"\\setlength\\PreviewBorder{0pt}",
"\\usepackage{amssymb}"))
par(mar = c(4, 4, 1, 1))
plot(1, type = "n", xlab = "$x_1$", ylab = "$x_2$")
text(1, c(0.8), c("$\\ddot{\\Omega}$"), cex = 2.5)
dev.off()
tools::texi2pdf("formula.tex")
system(paste(getOption("pdfviewer"), "formula.pdf"))
#-----------
Best;
David.
>
> Best;
> David.
>
>
>>
>> Thanks again!
>>
>> Best wishes,
>> Ranjan
>>
>>
>>
>> On Sun, 14 May 2017 23:57:50 +1000 Duncan Mackay <dulcalma at bigpond.com> wrote:
>>
>>> Hi
>>>
>>> I just had to do something similar in windows with \"{u}. Try Unicode symbol
>>> - see ?plotmath
>>>
>>> ggplot(data, aes(x=X)) + geom_line(aes(y = Z), size=0.43) +
>>> xlab(expression(atop(top,bold(Age~"\u00e4"))))
>>>
>>> Regards
>>>
>>> Duncan
>>>
>>> Duncan Mackay
>>> Department of Agronomy and Soil Science
>>> University of New England
>>> Armidale NSW 2351
>>> Email: home: mackay at northnet.com.au
>>>
>>> -----Original Message-----
>>> From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Ranjan
>>> Maitra
>>> Sent: Saturday, 13 May 2017 22:48
>>> To: r-help at stat.math.ethz.ch
>>> Subject: Re: [R] display double dot over character in plotmath?
>>>
>>> On Fri, 12 May 2017 23:39:14 -0700 Daniel Nordlund <djnordlund at gmail.com>
>>> wrote:
>>>
>>>> On 5/12/17 4:55 PM, Ranjan Maitra wrote:
>>>>> Hi,
>>>>>
>>>>> Is it possible to display double dot (umlaut) over a character such as
>>> would be possible using \ddot x in LaTeX? I can do this using tikzDevice but
>>> I wanted something simpler to point to.
>>>>>
>>>>> Here is an example of what I would like to do, but it is not quite
>>> there:
>>>>>
>>>>> require(ggplot2)
>>>>> data<-as.data.frame(c("a","b","c","a","b","c"))
>>>>> colnames(data)<-"Y"
>>>>> data$X<-c(1:6)
>>>>> data$Z<-c(1,2,3,1,2,3)
>>>>>
>>>>> ggplot(data, aes(x=X)) + geom_line(aes(y = Z), size=0.43) +
>>> xlab(expression(atop(top,bold(Age~"à"))))
>>>>>
>>>>> I would like to put in a double dot over the "a" in the x-axis instead
>>> of "`".
>>>>>
>>>>> Many thanks for any suggestions and best wishes,
>>>>> Ranjan
>>>>>
>>>>
>>>> You haven't told what OS you are using, but with Windows OS, you can get
>>>> the 'ä' by making sure the NUMLOCK key is on, hold down the alt key and
>>>> press 0228 on the numeric keypad.
>>>>
>>>>
>>>
>>> I am sorry, I use a linux operating system. I use Fedora 25 but the student
>>> I wanted to show this uses Ubuntu, though I don't know if the distribution
>>> matters.
>>>
>>> Thanks again for your help, and best wishes,
>>> Ranjan
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>>
>> --
>> Important Notice: This mailbox is ignored: e-mails are set to be deleted on receipt. Please respond to the mailing list if appropriate. For those needing to send personal or professional e-mail, please use appropriate addresses.
>>
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> David Winsemius
> Alameda, CA, USA
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
David Winsemius
Alameda, CA, USA
More information about the R-help
mailing list