2016-07-20 4 views
1

カスタム.styファイルとfancyhdrパッケージを使用してヘッダーをセットアップすると、ヘッダーテキストが自動的にフォーマットされ、.Rmdファイルで定義された最初のヘッダーからテキストが取得され、この動作を無効にすることはできません。例えば、私は、次のRマークダウンファイルR markdown:Latexヘッダーの問題

--- 
output: 
    pdf_document: 
    includes: 
     in_header: report.sty 
    keep_tex: yes 
geometry: tmargin=2cm, bmargin=2.5cm 
classoption: a4paper 
--- 

\pagenumbering{gobble} 

# Behavioural profile of your dog 

blah... blah... 

```{r echo} 

    # Some R code here... 

``` 

を持っており、これは.styファイルです:

% 
% This file must be saved with UTF-8 encoding, otherwise pandoc will complain 
% for instance about nordic characters. 
% 

\usepackage{palatino} 
\renewcommand{\familydefault}{\sfdefault} % sans serif 
\fontfamily{ppl}\selectfont 
\usepackage{blindtext} 
\usepackage{eso-pic, rotating, graphicx, calc} 
\usepackage[nomessages]{fp} 

% Code to add a vertical gray band in the inner margin : 
\usepackage{eso-pic} 
\definecolor{colorMarge}{RGB}{242,242,245} 
\newlength{\distance} 
\setlength{\distance}{0.0in} % 0.5in 
\newlength{\rulethickness} 
\setlength{\rulethickness}{0.3in} % 1pt 
\newlength{\ruleheight} 
\setlength{\ruleheight}{11in} % Longueur de la ligne 
\newlength{\xoffset} 
\newlength{\yoffset} 
\setlength{\yoffset}{0.5\dimexpr\paperheight-\ruleheight} 

\AddToShipoutPicture{% 
     \ifodd\value{page}% 
       \setlength{\xoffset}{\distance}% 
     \else 
       \setlength{\xoffset}{\dimexpr\paperwidth-\rulethickness-\distance}% 
     \fi 
     \AtPageLowerLeft{\put(\LenToUnit{\xoffset},\LenToUnit{\yoffset}){\color{colorMarge}\rule{\rulethickness}{\ruleheight}}}% 
} 

\newcommand{\sidewaysText}{R Development Core Team (2008). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. ISBN 3-900051-07-0, URL http://www.R-project.org.} 

%\newlength{\swtLen} 
%\setlength{\swtLen}{\widthof{\sidewaysText}} 
%\newlength{\swtPos} 
%\setlength{\swtPos}{\yoffset} 
%\addtolength{\swtPos}{0.5\swtLen} 

%\newlength{\swtPos} 
%\setlength{\swtPos}{350em} 

\AddToShipoutPicture{\put(5,10){\rotatebox{90}{\scalebox{0.8}{\sidewaysText}}}} 

\usepackage{fancyhdr} 
\pagestyle{fancy} 
\renewcommand{\headrulewidth}{0.4pt} 
\renewcommand{\footrulewidth}{0.4pt} 
\chead{I want this header} 
\lfoot{\scriptsize 
Here is some footer text.} 

しかし、これが出力されます:

enter image description here

することができますように「これはいくつかのヘッダー」がヘッダーの一部として大文字、イタリックで表示され、右に揃っています。これを避ける方法は?

ありがとうございます!

答えて

1

、明確なすべてのヘッダ/フッタreport.styfancyhdrをロード\fancyhf{}を使用した後。まだコンテンツの仕様が含まれていてもよい..:ヘッダー/フッターの他の4つのコンポーネント(l EFT、cエントレ、r IGHTそれぞれのための3つが)だから、

\usepackage{fancyhdr} 
\pagestyle{fancy} 
\fancyhf{}% Clear header/footer 
\renewcommand{\headrulewidth}{0.4pt}% Header rule 
\renewcommand{\footrulewidth}{0.4pt}% Footer rule 
\chead{I want this header}% Centre header 
\lfoot{\scriptsize Here is some footer text.}% Left footer 
あなただけ \chead設定した

\lfoot、あります彼らが何であろうと。 \fancyhf{}はこれらすべてを消去し、必要に応じて設定することができます。

もちろん、r ight headを消去したい場合は、\rhead{}も実行できます。

+0

こんにちは、ありがとう!遅延返信をおかけして申し訳ありません。それは完璧に働いた。 – user2641103