I have a following problem. I prepare a project in R and always get a problem that after knitting formulas are partially outside of pdf document.
Formula issue formatting description
There is a post with similar problem, but it didn't help (R Markdown Knitr to PDF Code Outside Margin)
I have also tried adding "\\", but it also didn't help.
Is there any easy solution about how to organize auto line breaks in formulas in Rmarkdown? I don't want to convert html to pdf since I would lose all internal references then.
I will be very grateful if someone would help!!!
Update:
Here is a sample formula for rmarkdown:
---
title: "Code Sample"
output:
pdf_document: default
html_document: default
---
1) $$ (\sum_{i = 1}^{N} \|x_i - \mu - V_q \lambda_i\|^2)'_\mu = \\
(\sum_{i = 1}^{N} (x_i - \mu - V_q \lambda_i)^T (x_i - \mu - V_q \lambda_i))'_\mu = \\
= \sum_{i = 1}^{N} ((x_i - \mu - V_q \lambda_i)^T (x_i - \mu - V_q \lambda_i))'_\mu = \\
= \sum_{i = 1}^{N} 2 (x_i - \mu - V_q \lambda_i) \cdot (-1) = \\
= \sum_{i = 1}^{N} -2 \cdot (x_i - \mu - V_q \lambda_i) \\
\text{since the degree was 2 and the sign of $\mu$ was '-' (minus)} $$