【问题标题】:Having problems with \headheight in LaTeX R-Markdown (inconsistent page layout)在 LaTeX R-Markdown 中遇到 \headheight 问题(页面布局不一致)
【发布时间】:2019-08-22 06:39:25
【问题描述】:

我目前在 Rmarkdown 中遇到了乳胶问题(使用 fancyhdr 包)。我正在尝试制作具有某种模板样式的数据报告。但截至目前,我的每一页的标题 1 都没有正确对齐。我认为这与我的 \headheight 有关,但我不确定如何解决它。

目前这是在 R-markdown 中完成的,我非常确信这个问题与我的 YAML 有关。如果有人能告诉我如何修复我的 \headheight 的 YAML 编码或整体改进我的 YAML 编码以解决重叠问题,我将不胜感激。

运行此代码时没有错误,但这是它们提供给我的警告(但我不知道如何解决警告)

Package Fancyhdr Warning: \headheight is too small (12.0pt): 
 Make it at least 32.08571pt.
 We now make it that large for the rest of the document.
 This may cause the page layout to be inconsistent, however. 

这是我的 YAML:

---
output: 
  pdf_document:
    latex_engine: pdflatex
header-includes:|
  \usepackage{graphicx}
  \usepackage{fancyhdr}
  \pagestyle{fancy}
  \newcommand{\helv}{%
    \fontfamily{phv}\fontseries{b}\fontsize{9}{11}\selectfont}
  \fancyhead[R]{\includegraphics[width=3cm]{logo.png}}
  \fancyhead[L]{\textbf\selectfont\sffamily{Daily Report}}
  \fancyfoot[L]{\textbf\selectfont\sffamily{NOT INTENDED FOR FORWARDING}}
  \renewcommand{\headrulewidth}{0.4pt}
  \renewcommand{\footrulewidth}{0.4pt}
classoption: a4paper
---

这些都在其余的代码中:

```r-markdown

## \selectfont\sffamily{EQUITY 1}

# content page 1 

\newpage

## \selectfont\sffamily{EQUITY 2} 

# content page 2 

我在 TeXStackExchange 上发布了 pdf 输出的图像:https://tex.stackexchange.com/questions/482525/having-problems-with-latex-coding-in-rmarkdown-fancyhdr-headheight

我希望所有这些都相互对齐。我不知道我在 YAML 中的编码是否正确。

【问题讨论】:

    标签: r latex r-markdown pdflatex


    【解决方案1】:

    警告非常明确,头部高度需要大于 32.08571pt。可以通过添加例如满足此要求。 \setlength{\headheight}{32.09pt} 到您的标头包含。

    ---
    output: 
      pdf_document:
        latex_engine: pdflatex
    header-includes:|
      \usepackage{graphicx}
      \usepackage{fancyhdr}
      \pagestyle{fancy}
      \newcommand{\helv}{%
        \fontfamily{phv}\fontseries{b}\fontsize{9}{11}\selectfont}
      \fancyhead[R]{\includegraphics[width=3cm]{logo.png}}
      \fancyhead[L]{\textbf\selectfont\sffamily{Daily Report}}
      \fancyfoot[L]{\textbf\selectfont\sffamily{NOT INTENDED FOR FORWARDING}}
      \renewcommand{\headrulewidth}{0.4pt}
      \renewcommand{\footrulewidth}{0.4pt}
      \setlength{\headheight}{32.09pt}
    classoption: a4paper
    ---
    

    【讨论】:

      猜你喜欢
      • 2020-02-04
      • 2014-11-28
      • 2016-07-28
      • 1970-01-01
      • 1970-01-01
      • 2010-09-26
      • 2012-10-16
      • 2018-03-22
      • 2013-12-08
      相关资源
      最近更新 更多