I would like to pass a string from R script in order to run href in my rnw file. In the R script I have to include double \\ for the href otherwise I get error.

       ui_string<-paste0("\\\\href{",url_ui_1,"}{ here}")

In the nrw file I pick up ui_string1 but as the string has \ it errors on me. Is there anyway to pass single \ so that the href code works?

\documentclass[11pt,a4paper, titlepage]{article}
\renewcommand{\familydefault}{\sfdefault}%sets fonts across document
 \textbf{Your Vunerabilities}\\
  • Can you add as well your R code that seems to produce an error for you? (The actual rnw file) – Alex Recuenco Dec 11 '17 at 11:49
  • 1
    In any case, first you need to remove the double `\` that you have at the end of your latex file. That part will certainly produce an error. Since you are finishing a paragraph when there is no line to end. – Alex Recuenco Dec 11 '17 at 11:54
  • Ive managed to solve this! I simply had to add in four \ in my R code rather than one \. Now it all works nicely! – Siobhan Dec 11 '17 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.