
Я знаю, что можно настроить вывод knitr
фрагмента кода так, чтобы он выглядел так, как вам нужно. Моя проблема возникает при использовании пакета parskip
. parskip
Пакет добавляет немного дополнительного пространства под выводом кода, что выглядит не очень. Вот минимальный .Rnw
файл.
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=1in]{geometry}
\usepackage{parskip}
\begin{document}
\setlength{\parindent}{0in}
Some text above chunk
<<echo=TRUE>>=
2 + 2
@
Some text below. The space above this is too big when using the \texttt{parskip} package.
Some text below. The space above this is too big when using the \texttt{parskip} package.
Some text below. The space above this is too big when using the \texttt{parskip} package.
A nice space between paragraphs.
\end{document}
решение1
Это не элегантный ответ, но вы можете «исправить» избыточное пространство, включив отрицательное вертикальное пространство. Смотрите измененный код.
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=1in]{geometry}
%\usepackage{parskip}
\begin{document}
\setlength{\parindent}{0in}
Some text above chunk
<<echo=TRUE>>=
2 + 2
@
\vspace{-1em} %%% this moves the following text up the height of an 'm'
Some text below. The space above this is too big when using the \texttt{parskip} package.
Some text below. The space above this is too big when using the \texttt{parskip} package.
Some text below. The space above this is too big when using the \texttt{parskip} package.
A nice space between paragraphs.
\end{document}