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

Assistance Needed with R and latex2exp for Latex Conversion #62

Open
vardavas opened this issue Aug 5, 2023 · 0 comments
Open

Assistance Needed with R and latex2exp for Latex Conversion #62

vardavas opened this issue Aug 5, 2023 · 0 comments

Comments

@vardavas
Copy link

vardavas commented Aug 5, 2023

Dear Dr. Meschiari,

I apologize for any inconvenience with the following message regarding an issue I'm having with using latex2exp.

My name is Raffaele Vardavas, and I recently came across your insightful post that describes the utilization of your latex2exp package, particularly emphasizing the significance of employing raw strings. Your example, where "\Psi" was transformed into r"(\Psi)", greatly clarified this process.

Nonetheless, I am encountering challenges in handling the case when my string is a variable. For example, the following command works fine:

latex2exp::TeX(r'($\tilde{\alpha}_k$)')

but what if my input variable is "\tilde{\alpha}_k" such as in the following code:

x<-"\tilde{\alpha}_k"
parsed_expr <- paste0("r'($",x,"$)'")
latex2exp::TeX(x)

this does not give me the same output. I need to process a vector read from an excel spreadsheet, where each element x is a LaTeX expression and convert them to a vector or list that contains the elements latex2exp::TeX(x) as my outputs. The issue is very much linked to the single backslash, and all my attempts in getting a working solution by asking chatGPT end with frustrating failures.

Any guidance or insight you can provide regarding the conversion would be greatly appreciated.

Thanks!
Raff

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

No branches or pull requests

1 participant