You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bad<-"It's 5:45 and I've got $5.45 in my pocket.\nThe __area of a circle__ is $A =\n\\pi r^2$, where\n$\\pi$ is irrational when it hasn't had its coffee."
361
+
fails<-tinkr::yarn$new(textConnection(bad))
362
+
fails$show()
363
+
#| It's 5:45 and I've got $5.45 in my pocket.
364
+
#| The **area of a circle** is $A =
365
+
#| \\pi r^2$, where
366
+
#| $\\pi$ is irrational when it hasn't had its coffee.
367
+
fails$
368
+
protect_math()$
369
+
show()
370
+
#| Error: Inline math delimiters are not balanced.
371
+
#|
372
+
#| HINT: If you are writing BASIC code, make sure you wrap variable
373
+
#| names and code in backtics like so: `INKEY$`.
374
+
#|
375
+
#| Below are the pairs that were found:
376
+
#| start...end
377
+
#| -----...---
378
+
#| It's 5:45 and I've got $5.45 in my pocket....\pi r^2$, where
379
+
#| is $A =...
380
+
# This works
381
+
good<-"It's 5:45 and I've got $5.45 in my pocket.\nThe __area of a circle__ is $A = \\pi r^2$, where\n$\\pi$ is irrational when it hasn't had its coffee."
382
+
works<-tinkr::yarn$new(textConnection(good))
383
+
works$show()
384
+
#| It's 5:45 and I've got $5.45 in my pocket.
385
+
#| The **area of a circle** is $A = \\pi r^2$, where
386
+
#| $\\pi$ is irrational when it hasn't had its coffee.
387
+
works$
388
+
protect_math()$
389
+
show()
390
+
#| It's 5:45 and I've got $5.45 in my pocket.
391
+
#| The **area of a circle** is $A = \pi r^2$, where
392
+
#| $\pi$ is irrational when it hasn't had its coffee.
Copy file name to clipboardExpand all lines: man/rmd-fragments/format-latex.Rmd
+19Lines changed: 19 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -28,3 +28,22 @@ you must be sure to either use punctuation after the trailing dollar sign OR for
28
28
math$head(15) # malformed
29
29
math$protect_math() #error
30
30
```
31
+
4.**use of `$` as currency will still work**, but there is a caveat that mixing
32
+
this inline math broken across lines will cause problems:
33
+
```{r, split, error = TRUE}
34
+
# this will be mal-formed
35
+
bad <- "It's 5:45 and I've got $5.45 in my pocket.\nThe __area of a circle__ is $A =\n \\pi r^2$, where\n$\\pi$ is irrational when it hasn't had its coffee."
36
+
fails <- tinkr::yarn$new(textConnection(bad))
37
+
fails$show()
38
+
fails$
39
+
protect_math()$
40
+
show()
41
+
# This works
42
+
good <- "It's 5:45 and I've got $5.45 in my pocket.\nThe __area of a circle__ is $A = \\pi r^2$, where\n$\\pi$ is irrational when it hasn't had its coffee."
0 commit comments