When mixing LaTeX and markdown in this example, is it possible to create a correct inline solution?

Disclaimer: Something of a cross post, please notify me if this is not valuable.

In an answer to a stackoverflow question the following was a suggested solution:


title: "sample"
output: pdf_document
header-includes:

  • \usepackage{booktabs}

```{r sample, echo=FALSE, results='asis'}
library(knitr)
library(xtable)

t1 <- kable(head(mtcars)[1:3], format = "latex", booktabs = TRUE)
t2 <- kable(head(mtcars)[4:6], format = "latex", booktabs = TRUE)

cat(c("\\begin{table}[!htb]
    \\begin{minipage}{.5\\linewidth}
      \\caption{}
      \\centering",
        t1,
    "\\end{minipage}%
    \\begin{minipage}{.5\\linewidth}
      \\centering
        \\caption{}",
        t2,
    "\\end{minipage} 
\\end{table}"
))  

However, it appears the backticks are printed above and below each table.

Is it possible to escape these backticks in the LaTeX but not the markdown? \ before the backticks throws an error, and the backticks are required to not render r t1 as text instead of the desired table. What have I missed to render the tables, but not the backticks?
[/quote]

This seems to be constructing a string output and then passing it to LaTeX to render. I was curious if I could modify this to be an inline solution similar to this:

\begin{table}[!htb]
    \begin{minipage}{.5\linewidth}
      \caption{}
      \centering,
       `r t1`,
    \end{minipage}%
    \begin{minipage}{.5\linewidth}
      \centering
        \caption{},
        `r t2`,
    \end{minipage} 
\end{table}

However, it appears the backticks are printed above and below each table.

Is it possible to escape these backticks in the LaTeX but not the markdown? \ before the backticks throws an error, and the backticks are required to not render r t1 as text instead of the desired table. What have I missed to render the tables, but not the backticks?