Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add phantom #22

Merged
merged 1 commit into from
Mar 14, 2021
Merged

Add phantom #22

merged 1 commit into from
Mar 14, 2021

Conversation

wzel
Copy link
Contributor

@wzel wzel commented Mar 29, 2019

Add \phantom{} support.

Copy link

@gtalckmin gtalckmin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, does this add the \phantom command ?
I tried from the wzel github package, however the \phantom{whatever} is mapped a string not as a latex command.
It would be great to have this functionality as this would allow parsing parts of a math expression under phantom (other parts, not) and, using several annotations, have a colourized annotation on ggplot2.

@wzel
Copy link
Contributor Author

wzel commented Jul 15, 2020

Hi,

I just checked, and it works for me in annotations:

library(ggplot2)
library(latex2exp)

ggplot(data.frame(x = 1:2, y = 1:2),
       aes(x = x, y = y)) +
   geom_point() +
   annotate("text",
            x = 1.5, y = 1.5,
            label = TeX("a\\phantom{b}c"),
            parse = TRUE)

@gtalckmin
Copy link

gtalckmin commented Jul 15, 2020

This is what I have as output:
phantom
with this warning message:

Warning message:
In is.na(x) : is.na() applied to non-(list or vector) of type 'expression'

I installed the package from your repository using
devtools::install_github("wzel/latex2exp")

these are the versions of the libraries installed.
[1] latex2exp_0.4.0 ggplot2_3.3.2

Runing R version 4.02, Rstudio/Windows 10

Solution
devtools::install_github(repo = "wzel/latex2exp", ref = "add-phantom")

PS: sorry was my mistake! Thanks for that , mate

@wzel
Copy link
Contributor Author

wzel commented Jul 20, 2020

Glad that you find this useful.

Copy link
Owner

@stefano-meschiari stefano-meschiari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Sorry for the delay in checking out and merging this PR — I'm just now catching up and implementing some of the improvements I had in the backlog.

@stefano-meschiari stefano-meschiari merged commit 3bc88c8 into stefano-meschiari:master Mar 14, 2021
@stefano-meschiari stefano-meschiari mentioned this pull request Mar 14, 2021
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Aug 28, 2021
# latex2exp 0.5.0

* Update Documentation to use the new  raw strings introduced in R 4.0
  (which lets one do away with the quoting of the backslash character;
  e.g.   one   can    use   `TeX(r'($\alpha^\beta$)')`   rather   than
  `TeX('\\alpha^\\beta)`)
* Adds parameters `bold` and `italic` to `TeX()`. These can be used to
  make the entire expression bold or italic.
* Adds `\phantom{}`
  ([PR](stefano-meschiari/latex2exp#22))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants