การเพิ่มหัวจดหมายลงใน RMarkdown PDF

ฉันกำลังพยายามจำลองรายงานโดยใช้ RMarkdown/LaTeX เป็นไปได้ไหมที่จะเพิ่มหัวจดหมายที่ด้านบนของหน้าในลักษณะเดียวกันกับรูปภาพที่ฉันแนบ หวังว่าจะพบวิธีแก้ปัญหาโดยที่ฉันสามารถมีหัวจดหมายพร้อมโลโก้ได้ (และที่ฉันสามารถปรับแต่งข้อความและสีของหัวจดหมายได้อย่างง่ายดายด้วย)

TIA

ป้อนคำอธิบายรูปภาพที่นี่

ฉันใช้คลาสเอกสาร article มาตรฐาน นี่คือ YAML ของฉันใน RMarkdown

---
title: "Untitled"
author: "Name"
date: "4/8/2021"
output: pdf_document
---

แก้ไข - ฉันได้เพิ่มไฟล์ .log ของฉันด้านล่าง

This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 20.11) (preloaded format=pdflatex 2020.12.22)  10 APR 2021 20:36
entering extended mode
**./report.tex
(report.tex
LaTeX2e <2020-10-01> patch level 2
L3 programming layer <2020-10-27> xparse <2020-03-03> ("C:\Program Files\MiKTeX
\tex/latex/base\article.cls"
Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
("C:\Program Files\MiKTeX\tex/latex/base\size10.clo"
File: size10.clo 2020/04/10 v1.4m Standard LaTeX file (size option)
)
\c@part=\count175
\c@section=\count176
\c@subsection=\count177
\c@subsubsection=\count178
\c@paragraph=\count179
\c@subparagraph=\count180
\c@figure=\count181
\c@table=\count182
\abovecaptionskip=\skip47
\belowcaptionskip=\skip48
\bibindent=\dimen138
) ("C:\Program Files\MiKTeX\tex/latex/lm\lmodern.sty"
Package: lmodern 2009/10/30 v1.6 Latin Modern Fonts
LaTeX Font Info:    Overwriting symbol font `operators' in version `normal'
(Font)                  OT1/cmr/m/n --> OT1/lmr/m/n on input line 22.
LaTeX Font Info:    Overwriting symbol font `letters' in version `normal'
(Font)                  OML/cmm/m/it --> OML/lmm/m/it on input line 23.
LaTeX Font Info:    Overwriting symbol font `symbols' in version `normal'
(Font)                  OMS/cmsy/m/n --> OMS/lmsy/m/n on input line 24.
LaTeX Font Info:    Overwriting symbol font `largesymbols' in version `normal'
(Font)                  OMX/cmex/m/n --> OMX/lmex/m/n on input line 25.
LaTeX Font Info:    Overwriting symbol font `operators' in version `bold'
(Font)                  OT1/cmr/bx/n --> OT1/lmr/bx/n on input line 26.
LaTeX Font Info:    Overwriting symbol font `letters' in version `bold'
(Font)                  OML/cmm/b/it --> OML/lmm/b/it on input line 27.
LaTeX Font Info:    Overwriting symbol font `symbols' in version `bold'
(Font)                  OMS/cmsy/b/n --> OMS/lmsy/b/n on input line 28.
LaTeX Font Info:    Overwriting symbol font `largesymbols' in version `bold'
(Font)                  OMX/cmex/m/n --> OMX/lmex/m/n on input line 29.
LaTeX Font Info:    Overwriting math alphabet `\mathbf' in version `normal'
(Font)                  OT1/cmr/bx/n --> OT1/lmr/bx/n on input line 31.
LaTeX Font Info:    Overwriting math alphabet `\mathsf' in version `normal'
(Font)                  OT1/cmss/m/n --> OT1/lmss/m/n on input line 32.
LaTeX Font Info:    Overwriting math alphabet `\mathit' in version `normal'
(Font)                  OT1/cmr/m/it --> OT1/lmr/m/it on input line 33.
LaTeX Font Info:    Overwriting math alphabet `\mathtt' in version `normal'
(Font)                  OT1/cmtt/m/n --> OT1/lmtt/m/n on input line 34.
LaTeX Font Info:    Overwriting math alphabet `\mathbf' in version `bold'
(Font)                  OT1/cmr/bx/n --> OT1/lmr/bx/n on input line 35.
LaTeX Font Info:    Overwriting math alphabet `\mathsf' in version `bold'
(Font)                  OT1/cmss/bx/n --> OT1/lmss/bx/n on input line 36.
LaTeX Font Info:    Overwriting math alphabet `\mathit' in version `bold'
(Font)                  OT1/cmr/bx/it --> OT1/lmr/bx/it on input line 37.
LaTeX Font Info:    Overwriting math alphabet `\mathtt' in version `bold'
(Font)                  OT1/cmtt/m/n --> OT1/lmtt/m/n on input line 38.
) ("C:\Program Files\MiKTeX\tex/latex/amsmath\amsmath.sty"
Package: amsmath 2020/09/23 v2.17i AMS math features
\@mathmargin=\skip49
For additional information on amsmath, use the `?' option.
("C:\Program Files\MiKTeX\tex/latex/amsmath\amstext.sty"
Package: amstext 2000/06/29 v2.01 AMS text
("C:\Program Files\MiKTeX\tex/latex/amsmath\amsgen.sty"
File: amsgen.sty 1999/11/30 v2.0 generic functions
\@emptytoks=\toks15
\ex@=\dimen139
)) ("C:\Program Files\MiKTeX\tex/latex/amsmath\amsbsy.sty"
Package: amsbsy 1999/11/29 v1.2d Bold Symbols
\pmbraise@=\dimen140
) ("C:\Program Files\MiKTeX\tex/latex/amsmath\amsopn.sty"
Package: amsopn 2016/03/08 v2.02 operator names
)
\inf@bad=\count183
LaTeX Info: Redefining \frac on input line 234.
\uproot@=\count184
\leftroot@=\count185
LaTeX Info: Redefining \overline on input line 399.
\classnum@=\count186
\DOTSCASE@=\count187
LaTeX Info: Redefining \ldots on input line 496.
LaTeX Info: Redefining \dots on input line 499.
LaTeX Info: Redefining \cdots on input line 620.
\Mathstrutbox@=\box47
\strutbox@=\box48
\big@size=\dimen141
LaTeX Font Info:    Redeclaring font encoding OML on input line 743.
LaTeX Font Info:    Redeclaring font encoding OMS on input line 744.
\macc@depth=\count188
\c@MaxMatrixCols=\count189
\dotsspace@=\muskip16
\c@parentequation=\count190
\dspbrk@lvl=\count191
\tag@help=\toks16
\row@=\count192
\column@=\count193
\maxfields@=\count194
\andhelp@=\toks17
\eqnshift@=\dimen142
\alignsep@=\dimen143
\tagshift@=\dimen144
\tagwidth@=\dimen145
\totwidth@=\dimen146
\lineht@=\dimen147
\@envbody=\toks18
\multlinegap=\skip50
\multlinetaggap=\skip51
\mathdisplay@stack=\toks19
LaTeX Info: Redefining \[ on input line 2923.
LaTeX Info: Redefining \] on input line 2924.
) ("C:\Program Files\MiKTeX\tex/generic/iftex\ifxetex.sty"
Package: ifxetex 2019/10/25 v0.7 ifxetex legacy package. Use iftex instead.
("C:\Program Files\MiKTeX\tex/generic/iftex\iftex.sty"
Package: iftex 2020/03/06 v1.0d TeX engine tests
)) ("C:\Program Files\MiKTeX\tex/generic/iftex\ifluatex.sty"
Package: ifluatex 2019/10/25 v1.5 ifluatex legacy package. Use iftex instead.
) ("C:\Program Files\MiKTeX\tex/latex/base\fontenc.sty"
Package: fontenc 2020/08/10 v2.0s Standard LaTeX package
LaTeX Font Info:    Trying to load font information for T1+lmr on input line 11
2.
("C:\Program Files\MiKTeX\tex/latex/lm\t1lmr.fd"
File: t1lmr.fd 2009/10/30 v1.6 Font defs for Latin Modern
)) ("C:\Program Files\MiKTeX\tex/latex/base\inputenc.sty"
Package: inputenc 2020/08/01 v1.3d Input encoding file
\inpenc@prehook=\toks20
\inpenc@posthook=\toks21
) ("C:\Program Files\MiKTeX\tex/latex/base\textcomp.sty"
Package: textcomp 2020/02/02 v2.0n Standard LaTeX package
) ("C:\Program Files\MiKTeX\tex/latex/amsfonts\amssymb.sty"
Package: amssymb 2013/01/14 v3.01 AMS font symbols
("C:\Program Files\MiKTeX\tex/latex/amsfonts\amsfonts.sty"
Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support
\symAMSa=\mathgroup4
\symAMSb=\mathgroup5
LaTeX Font Info:    Redeclaring math symbol \hbar on input line 98.
LaTeX Font Info:    Overwriting math alphabet `\mathfrak' in version `bold'
(Font)                  U/euf/m/n --> U/euf/b/n on input line 106.
)) ("C:\Program Files\MiKTeX\tex/latex/upquote\upquote.sty"
Package: upquote 2012/04/19 v1.3 upright-quote and grave-accent glyphs in verba
tim
) ("C:\Program Files\MiKTeX\tex/latex/microtype\microtype.sty"
Package: microtype 2019/11/18 v2.7d Micro-typographical refinements (RS)
("C:\Program Files\MiKTeX\tex/latex/graphics\keyval.sty"
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks22
)
\MT@toks=\toks23
\MT@count=\count195
LaTeX Info: Redefining \textls on input line 790.
\MT@outer@kern=\dimen148
LaTeX Info: Redefining \textmicrotypecontext on input line 1354.
\MT@listname@count=\count196
("C:\Program Files\MiKTeX\tex/latex/microtype\microtype-pdftex.def"
File: microtype-pdftex.def 2019/11/18 v2.7d Definitions specific to pdftex (RS)

LaTeX Info: Redefining \lsstyle on input line 914.
LaTeX Info: Redefining \lslig on input line 914.
\MT@outer@space=\skip52
)
Package microtype Info: Loading configuration file microtype.cfg.
("C:\Program Files\MiKTeX\tex/latex/microtype\microtype.cfg"
File: microtype.cfg 2019/11/18 v2.7d microtype main configuration file (RS)
)) ("C:\Program Files\MiKTeX\tex/latex/parskip\parskip.sty"
Package: parskip 2020-06-15 v2.0f non-zero parskip adjustments
("C:\Program Files\MiKTeX\tex/latex/kvoptions\kvoptions.sty"
Package: kvoptions 2020-10-07 v3.14 Key value format for package options (HO)
("C:\Program Files\MiKTeX\tex/generic/ltxcmds\ltxcmds.sty"
Package: ltxcmds 2020-05-10 v1.25 LaTeX kernel commands for general use (HO)
) ("C:\Program Files\MiKTeX\tex/generic/kvsetkeys\kvsetkeys.sty"
Package: kvsetkeys 2019/12/15 v1.18 Key value parser (HO)
)) ("C:\Program Files\MiKTeX\tex/latex/etoolbox\etoolbox.sty"
Package: etoolbox 2020/10/05 v2.5k e-TeX tools for LaTeX (JAW)
\etb@tempcnta=\count197
)) ("C:\Program Files\MiKTeX\tex/latex/xcolor\xcolor.sty"
Package: xcolor 2016/05/11 v2.12 LaTeX color extensions (UK)
("C:\Program Files\MiKTeX\tex/latex/graphics-cfg\color.cfg"
File: color.cfg 2016/01/02 v1.6 sample color configuration
)
Package xcolor Info: Driver file: pdftex.def on input line 225.
("C:\Program Files\MiKTeX\tex/latex/graphics-def\pdftex.def"
File: pdftex.def 2020/10/05 v1.2a Graphics/color driver for pdftex
)
Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1348.
Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1352.
Package xcolor Info: Model `RGB' extended on input line 1364.
Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1366.
Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1367.
Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1368.
Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1369.
Package xcolor Info: Model `Gray' substituted by `gray' on input line 1370.
Package xcolor Info: Model `wave' substituted by `hsb' on input line 1371.
) ("C:\Program Files\MiKTeX\tex/latex/xurl\xurl.sty"
Package: xurl 2020/01/24 v 0.09 modify URL breaks
("C:\Program Files\MiKTeX\tex/latex/url\url.sty"
\Urlmuskip=\muskip17
Package: url 2013/09/16  ver 3.4  Verb mode for urls, etc.
)) ("C:\Program Files\MiKTeX\tex/latex/bookmark\bookmark.sty"
Package: bookmark 2020-11-06 v1.29 PDF bookmarks (HO)
("C:\Program Files\MiKTeX\tex/latex/hyperref\hyperref.sty"
Package: hyperref 2020-05-15 v7.00e Hypertext links for LaTeX
("C:\Program Files\MiKTeX\tex/generic/pdftexcmds\pdftexcmds.sty"
Package: pdftexcmds 2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO
)
("C:\Program Files\MiKTeX\tex/generic/infwarerr\infwarerr.sty"
Package: infwarerr 2019/12/03 v1.5 Providing info/warning/error messages (HO)
)
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode found.
) ("C:\Program Files\MiKTeX\tex/generic/kvdefinekeys\kvdefinekeys.sty"
Package: kvdefinekeys 2019-12-19 v1.6 Define keys (HO)
) ("C:\Program Files\MiKTeX\tex/generic/pdfescape\pdfescape.sty"
Package: pdfescape 2019/12/09 v1.15 Implements pdfTeX's escape features (HO)
) ("C:\Program Files\MiKTeX\tex/latex/hycolor\hycolor.sty"
Package: hycolor 2020-01-27 v1.10 Color options for hyperref/bookmark (HO)
) ("C:\Program Files\MiKTeX\tex/latex/letltxmacro\letltxmacro.sty"
Package: letltxmacro 2019/12/03 v1.6 Let assignment for LaTeX macros (HO)
) ("C:\Program Files\MiKTeX\tex/latex/auxhook\auxhook.sty"
Package: auxhook 2019-12-17 v1.6 Hooks for auxiliary files (HO)
)
\@linkdim=\dimen149
\Hy@linkcounter=\count198
\Hy@pagecounter=\count199
("C:\Program Files\MiKTeX\tex/latex/hyperref\pd1enc.def"
File: pd1enc.def 2020-05-15 v7.00e Hyperref: PDFDocEncoding definition (HO)
Now handling font encoding PD1 ...
... no UTF-8 mapping file for font encoding PD1
) ("C:\Program Files\MiKTeX\tex/generic/intcalc\intcalc.sty"
Package: intcalc 2019/12/15 v1.3 Expandable calculations with integers (HO)
) ("C:\Program Files\MiKTeX\tex/generic/etexcmds\etexcmds.sty"
Package: etexcmds 2019/12/15 v1.7 Avoid name clashes with e-TeX commands (HO)
)
\Hy@SavedSpaceFactor=\count266
Package hyperref Info: Option `unicode' set `true' on input line 4338.
("C:\Program Files\MiKTeX\tex/latex/hyperref\puenc.def"
File: puenc.def 2020-05-15 v7.00e Hyperref: PDF Unicode definition (HO)
Now handling font encoding PU ...
... no UTF-8 mapping file for font encoding PU
)
Package hyperref Info: Hyper figures OFF on input line 4464.
Package hyperref Info: Link nesting OFF on input line 4469.
Package hyperref Info: Hyper index ON on input line 4472.
Package hyperref Info: Plain pages OFF on input line 4479.
Package hyperref Info: Backreferencing OFF on input line 4484.
Package hyperref Info: Implicit mode ON; LaTeX internals redefined.
Package hyperref Info: Bookmarks ON on input line 4717.
\c@Hy@tempcnt=\count267
LaTeX Info: Redefining \url on input line 5076.
\XeTeXLinkMargin=\dimen150
("C:\Program Files\MiKTeX\tex/generic/bitset\bitset.sty"
Package: bitset 2019/12/09 v1.3 Handle bit-vector datatype (HO)
("C:\Program Files\MiKTeX\tex/generic/bigintcalc\bigintcalc.sty"
Package: bigintcalc 2019/12/15 v1.5 Expandable calculations on big integers (HO
)
))
\Fld@menulength=\count268
\Field@Width=\dimen151
\Fld@charsize=\dimen152
Package hyperref Info: Hyper figures OFF on input line 6347.
Package hyperref Info: Link nesting OFF on input line 6352.
Package hyperref Info: Hyper index ON on input line 6355.
Package hyperref Info: backreferencing OFF on input line 6362.
Package hyperref Info: Link coloring OFF on input line 6367.
Package hyperref Info: Link coloring with OCG OFF on input line 6372.
Package hyperref Info: PDF/A mode OFF on input line 6377.
LaTeX Info: Redefining \ref on input line 6417.
LaTeX Info: Redefining \pageref on input line 6421.
("C:\Program Files\MiKTeX\tex/latex/base\atbegshi-ltx.sty"
Package: atbegshi-ltx 2020/08/17 v1.0a Emulation of the original atbegshi packa
ge
with kernel methods
)
\Hy@abspage=\count269
\c@Item=\count270
\c@Hfootnote=\count271
)
Package hyperref Info: Driver (autodetected): hpdftex.
("C:\Program Files\MiKTeX\tex/latex/hyperref\hpdftex.def"
File: hpdftex.def 2020-05-15 v7.00e Hyperref driver for pdfTeX
("C:\Program Files\MiKTeX\tex/latex/base\atveryend-ltx.sty"
Package: atveryend-ltx 2020/08/19 v1.0a Emulation of the original atvery packag
e
with kernel methods
)
\Fld@listcount=\count272
\c@bookmark@seq@number=\count273
("C:\Program Files\MiKTeX\tex/latex/rerunfilecheck\rerunfilecheck.sty"
Package: rerunfilecheck 2019/12/05 v1.9 Rerun checks for auxiliary files (HO)
("C:\Program Files\MiKTeX\tex/generic/uniquecounter\uniquecounter.sty"
Package: uniquecounter 2019/12/15 v1.4 Provide unlimited unique counter (HO)
)
Package uniquecounter Info: New unique counter `rerunfilecheck' on input line 2
86.
)
\Hy@SectionHShift=\skip53
) ("C:\Program Files\MiKTeX\tex/latex/bookmark\bkm-pdftex.def"
File: bkm-pdftex.def 2020-11-06 v1.29 bookmark driver for pdfTeX (HO)
\BKM@id=\count274
)) ("C:\Program Files\MiKTeX\tex/latex/geometry\geometry.sty"
Package: geometry 2020/01/02 v5.9 Page Geometry
("C:\Program Files\MiKTeX\tex/generic/iftex\ifvtex.sty"
Package: ifvtex 2019/10/25 v1.7 ifvtex legacy package. Use iftex instead.
)
\Gm@cnth=\count275
\Gm@cntv=\count276
\c@Gm@tempcnt=\count277
\Gm@bindingoffset=\dimen153
\Gm@wd@mp=\dimen154
\Gm@odd@mp=\dimen155
\Gm@even@mp=\dimen156
\Gm@layoutwidth=\dimen157
\Gm@layoutheight=\dimen158
\Gm@layouthoffset=\dimen159
\Gm@layoutvoffset=\dimen160
\Gm@dimlist=\toks24
("C:\Program Files\MiKTeX\tex/latex/geometry\geometry.cfg")) ("C:\Program Files
\MiKTeX\tex/latex/graphics\graphicx.sty"
Package: graphicx 2020/09/09 v1.2b Enhanced LaTeX Graphics (DPC,SPQR)
("C:\Program Files\MiKTeX\tex/latex/graphics\graphics.sty"
Package: graphics 2020/08/30 v1.4c Standard LaTeX Graphics (DPC,SPQR)
("C:\Program Files\MiKTeX\tex/latex/graphics\trig.sty"
Package: trig 2016/01/03 v1.10 sin cos tan (DPC)
) ("C:\Program Files\MiKTeX\tex/latex/graphics-cfg\graphics.cfg"
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
)
Package graphics Info: Driver file: pdftex.def on input line 105.
)
\Gin@req@height=\dimen161
\Gin@req@width=\dimen162
)
\@input{preamble.aux}
\openout2 = `preamble.aux'.

(preamble.tex ("C:\Program Files\MiKTeX\tex/latex/fancyhdr\fancyhdr.sty"
Package: fancyhdr 2019/01/31 v3.10 Extensive control of page headers and footer
s
\f@nch@headwidth=\skip54
\f@nch@O@elh=\skip55
\f@nch@O@erh=\skip56
\f@nch@O@olh=\skip57
\f@nch@O@orh=\skip58
\f@nch@O@elf=\skip59
\f@nch@O@erf=\skip60
\f@nch@O@olf=\skip61
\f@nch@O@orf=\skip62
) ("C:\Program Files\MiKTeX\tex/latex/pgf/frontendlayer\tikz.sty" ("C:\Program 
Files\MiKTeX\tex/latex/pgf/basiclayer\pgf.sty" ("C:\Program Files\MiKTeX\tex/la
tex/pgf/utilities\pgfrcs.sty" ("C:\Program Files\MiKTeX\tex/generic/pgf/utiliti
es\pgfutil-common.tex"
\pgfutil@everybye=\toks25
\pgfutil@tempdima=\dimen163
\pgfutil@tempdimb=\dimen164
("C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgfutil-common-lists.tex"))
("C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgfutil-latex.def"
\pgfutil@abb=\box49
) ("C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgfrcs.code.tex" ("C:\Pro
gram Files\MiKTeX\tex/generic/pgf\pgf.revision.tex")
Package: pgfrcs 2020/11/23 v3.1.7 (3.1.7)
))
Package: pgf 2020/11/23 v3.1.7 (3.1.7)
("C:\Program Files\MiKTeX\tex/latex/pgf/basiclayer\pgfcore.sty" ("C:\Program Fi
les\MiKTeX\tex/latex/pgf/systemlayer\pgfsys.sty" ("C:\Program Files\MiKTeX\tex/
generic/pgf/systemlayer\pgfsys.code.tex"
Package: pgfsys 2020/11/23 v3.1.7 (3.1.7)
("C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgfkeys.code.tex"
\pgfkeys@pathtoks=\toks26
\pgfkeys@temptoks=\toks27
("C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgfkeysfiltered.code.tex"
\pgfkeys@tmptoks=\toks28
))
\pgf@x=\dimen165
\pgf@y=\dimen166
\pgf@xa=\dimen167
\pgf@ya=\dimen168
\pgf@xb=\dimen169
\pgf@yb=\dimen170
\pgf@xc=\dimen171
\pgf@yc=\dimen172
\pgf@xd=\dimen173
\pgf@yd=\dimen174
\w@pgf@writea=\write3
\r@pgf@reada=\read2
\c@pgf@counta=\count278
\c@pgf@countb=\count279
\c@pgf@countc=\count280
\c@pgf@countd=\count281
\t@pgf@toka=\toks29
\t@pgf@tokb=\toks30
\t@pgf@tokc=\toks31
\pgf@sys@id@count=\count282
("C:\Program Files\MiKTeX\tex/generic/pgf/systemlayer\pgf.cfg"
File: pgf.cfg 2020/11/23 v3.1.7 (3.1.7)
)
Driver file for pgf: pgfsys-pdftex.def
("C:\Program Files\MiKTeX\tex/generic/pgf/systemlayer\pgfsys-pdftex.def"
File: pgfsys-pdftex.def 2020/11/23 v3.1.7 (3.1.7)
("C:\Program Files\MiKTeX\tex/generic/pgf/systemlayer\pgfsys-common-pdf.def"
File: pgfsys-common-pdf.def 2020/11/23 v3.1.7 (3.1.7)
))) ("C:\Program Files\MiKTeX\tex/generic/pgf/systemlayer\pgfsyssoftpath.code.t
ex"
File: pgfsyssoftpath.code.tex 2020/11/23 v3.1.7 (3.1.7)
\pgfsyssoftpath@smallbuffer@items=\count283
\pgfsyssoftpath@bigbuffer@items=\count284
) ("C:\Program Files\MiKTeX\tex/generic/pgf/systemlayer\pgfsysprotocol.code.tex
"
File: pgfsysprotocol.code.tex 2020/11/23 v3.1.7 (3.1.7)
)) ("C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcore.code.tex"
Package: pgfcore 2020/11/23 v3.1.7 (3.1.7)
("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmath.code.tex" ("C:\Program F
iles\MiKTeX\tex/generic/pgf/math\pgfmathcalc.code.tex" ("C:\Program Files\MiKTe
X\tex/generic/pgf/math\pgfmathutil.code.tex") ("C:\Program Files\MiKTeX\tex/gen
eric/pgf/math\pgfmathparser.code.tex"
\pgfmath@dimen=\dimen175
\pgfmath@count=\count285
\pgfmath@box=\box50
\pgfmath@toks=\toks32
\pgfmath@stack@operand=\toks33
\pgfmath@stack@operation=\toks34
) ("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.code.tex" ("C
:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.basic.code.tex")
("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.trigonometric.c
ode.tex") ("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.rando
m.code.tex")
("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.comparison.code
.tex") ("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.base.cod
e.tex") ("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.round.c
ode.tex") ("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.misc.
code.tex")
("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.integerarithmet
ics.code.tex"))) ("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfloat.co
de.tex"
\c@pgfmathroundto@lastzeros=\count286
)) ("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfint.code.tex") ("C:\Progra
m Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorepoints.code.tex"
File: pgfcorepoints.code.tex 2020/11/23 v3.1.7 (3.1.7)
\pgf@picminx=\dimen176
\pgf@picmaxx=\dimen177
\pgf@picminy=\dimen178
\pgf@picmaxy=\dimen179
\pgf@pathminx=\dimen180
\pgf@pathmaxx=\dimen181
\pgf@pathminy=\dimen182
\pgf@pathmaxy=\dimen183
\pgf@xx=\dimen184
\pgf@xy=\dimen185
\pgf@yx=\dimen186
\pgf@yy=\dimen187
\pgf@zx=\dimen188
\pgf@zy=\dimen189
)
("C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorepathconstruct.code.
tex"
File: pgfcorepathconstruct.code.tex 2020/11/23 v3.1.7 (3.1.7)
\pgf@path@lastx=\dimen190
\pgf@path@lasty=\dimen191
) ("C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorepathusage.code.te
x"
File: pgfcorepathusage.code.tex 2020/11/23 v3.1.7 (3.1.7)
\pgf@shorten@end@additional=\dimen192
\pgf@shorten@start@additional=\dimen193
) ("C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorescopes.code.tex"
File: pgfcorescopes.code.tex 2020/11/23 v3.1.7 (3.1.7)
\pgfpic=\box51
\pgf@hbox=\box52
\pgf@layerbox@main=\box53
\pgf@picture@serial@count=\count287
)
("C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcoregraphicstate.code.t
ex"
File: pgfcoregraphicstate.code.tex 2020/11/23 v3.1.7 (3.1.7)
\pgflinewidth=\dimen194
)
("C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcoretransformations.cod
e.tex"
File: pgfcoretransformations.code.tex 2020/11/23 v3.1.7 (3.1.7)
\pgf@pt@x=\dimen195
\pgf@pt@y=\dimen196
\pgf@pt@temp=\dimen197
) ("C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorequick.code.tex"
File: pgfcorequick.code.tex 2020/11/23 v3.1.7 (3.1.7)
) ("C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcoreobjects.code.tex"
File: pgfcoreobjects.code.tex 2020/11/23 v3.1.7 (3.1.7)
)
("C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorepathprocessing.code
.tex"
File: pgfcorepathprocessing.code.tex 2020/11/23 v3.1.7 (3.1.7)
) ("C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorearrows.code.tex"
File: pgfcorearrows.code.tex 2020/11/23 v3.1.7 (3.1.7)
\pgfarrowsep=\dimen198
) ("C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcoreshade.code.tex"
File: pgfcoreshade.code.tex 2020/11/23 v3.1.7 (3.1.7)
\pgf@max=\dimen199
\pgf@sys@shading@range@num=\count288
\pgf@shadingcount=\count289
) ("C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcoreimage.code.tex"
File: pgfcoreimage.code.tex 2020/11/23 v3.1.7 (3.1.7)
("C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcoreexternal.code.tex"
File: pgfcoreexternal.code.tex 2020/11/23 v3.1.7 (3.1.7)
\pgfexternal@startupbox=\box54
)) ("C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorelayers.code.tex"
File: pgfcorelayers.code.tex 2020/11/23 v3.1.7 (3.1.7)
)
("C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcoretransparency.code.t
ex"
File: pgfcoretransparency.code.tex 2020/11/23 v3.1.7 (3.1.7)
) ("C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorepatterns.code.tex
"
File: pgfcorepatterns.code.tex 2020/11/23 v3.1.7 (3.1.7)
) ("C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorerdf.code.tex"
File: pgfcorerdf.code.tex 2020/11/23 v3.1.7 (3.1.7)
))) ("C:\Program Files\MiKTeX\tex/generic/pgf/modules\pgfmoduleshapes.code.tex"
File: pgfmoduleshapes.code.tex 2020/11/23 v3.1.7 (3.1.7)
\pgfnodeparttextbox=\box55
) ("C:\Program Files\MiKTeX\tex/generic/pgf/modules\pgfmoduleplot.code.tex"
File: pgfmoduleplot.code.tex 2020/11/23 v3.1.7 (3.1.7)
) ("C:\Program Files\MiKTeX\tex/latex/pgf/compatibility\pgfcomp-version-0-65.st
y"
Package: pgfcomp-version-0-65 2020/11/23 v3.1.7 (3.1.7)
\pgf@nodesepstart=\dimen256
\pgf@nodesepend=\dimen257
) ("C:\Program Files\MiKTeX\tex/latex/pgf/compatibility\pgfcomp-version-1-18.st
y"
Package: pgfcomp-version-1-18 2020/11/23 v3.1.7 (3.1.7)
)) ("C:\Program Files\MiKTeX\tex/latex/pgf/utilities\pgffor.sty" ("C:\Program F
iles\MiKTeX\tex/latex/pgf/utilities\pgfkeys.sty" ("C:\Program Files\MiKTeX\tex/
generic/pgf/utilities\pgfkeys.code.tex")) ("C:\Program Files\MiKTeX\tex/latex/p
gf/math\pgfmath.sty" ("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmath.cod
e.tex")) ("C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgffor.code.tex"
Package: pgffor 2020/11/23 v3.1.7 (3.1.7)
("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmath.code.tex")
\pgffor@iter=\dimen258
\pgffor@skip=\dimen259
\pgffor@stack=\toks35
\pgffor@toks=\toks36
)) ("C:\Program Files\MiKTeX\tex/generic/pgf/frontendlayer/tikz\tikz.code.tex"
Package: tikz 2020/11/23 v3.1.7 (3.1.7)

("C:\Program Files\MiKTeX\tex/generic/pgf/libraries\pgflibraryplothandlers.code
.tex"
File: pgflibraryplothandlers.code.tex 2020/11/23 v3.1.7 (3.1.7)
\pgf@plot@mark@count=\count290
\pgfplotmarksize=\dimen260
)
\tikz@lastx=\dimen261
\tikz@lasty=\dimen262
\tikz@lastxsaved=\dimen263
\tikz@lastysaved=\dimen264
\tikz@lastmovetox=\dimen265
\tikz@lastmovetoy=\dimen266
\tikzleveldistance=\dimen267
\tikzsiblingdistance=\dimen268
\tikz@figbox=\box56
\tikz@figbox@bg=\box57
\tikz@tempbox=\box58
\tikz@tempbox@bg=\box59
\tikztreelevel=\count291
\tikznumberofchildren=\count292
\tikznumberofcurrentchild=\count293
\tikz@fig@count=\count294
("C:\Program Files\MiKTeX\tex/generic/pgf/modules\pgfmodulematrix.code.tex"
File: pgfmodulematrix.code.tex 2020/11/23 v3.1.7 (3.1.7)
\pgfmatrixcurrentrow=\count295
\pgfmatrixcurrentcolumn=\count296
\pgf@matrix@numberofcolumns=\count297
)
\tikz@expandcount=\count298

("C:\Program Files\MiKTeX\tex/generic/pgf/frontendlayer/tikz/libraries\tikzlibr
arytopaths.code.tex"
File: tikzlibrarytopaths.code.tex 2020/11/23 v3.1.7 (3.1.7)
)))

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.11 \fancypagestyle{plain}[f
                             ancy]{} 
Here is how much of TeX's memory you used:
 21616 strings out of 479799
 380717 string characters out of 2879601
 671144 words of memory out of 3000000
 38283 multiletter control sequences out of 15000+200000
 538078 words of font info for 30 fonts, out of 3000000 for 9000
 1141 hyphenation exceptions out of 8191
 86i,0n,89p,513b,271s stack positions out of 5000i,500n,10000p,200000b,50000s

!  ==> Fatal error occurred, no output PDF file produced!


person Tanga94    schedule 30.03.2021    source แหล่งที่มา
comment
แพ็คเกจ fancyhdr อาจเป็นจุดเริ่มต้น คุณช่วยสร้าง ตัวอย่างที่ทำซ้ำได้น้อยที่สุด เพื่อแสดงให้เราเห็นว่าคุณใช้คลาสเอกสาร ฯลฯ ใดบ้าง   -  person samcarter_is_at_topanswers.xyz    schedule 30.03.2021
comment
สวัสดี @samcarter_is_at_topanswers.xyz ฉันได้แชร์ YAML ของฉันในโพสต์แล้ว เพียงใช้คลาสเอกสารมาตรฐานใน Rmarkdown   -  person Tanga94    schedule 08.04.2021


คำตอบ (1)


เพื่อให้คุณเริ่มต้นได้ คุณสามารถใช้ fancyhdr และ tikz เพื่อออกแบบส่วนหัวของคุณเอง:

---
title: "Untitled"
author: "Name"
date: "4/8/2021"
output: 
  pdf_document:
    keep_tex: true
header-includes:
   - \include{preamble}      
---

test

\newpage

test

และ preamble.tex:

\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{tikz}
\fancyhead{%
  \begin{tikzpicture}[remember picture, overlay, outer sep=0pt, inner sep=0pt]
  \fill[blue] (-18,5.5) rectangle ++(\paperwidth,-4cm);
  \node at (-17,3) {\includegraphics[width=2cm]{example-image}};
  \node[green,font=\large\sffamily\bfseries] at (-14,3) {some text};
  \end{tikzpicture}
}
\fancypagestyle{plain}[fancy]{}
\renewcommand{\headrulewidth}{0pt}
\setlength{\headheight}{4cm}
person samcarter_is_at_topanswers.xyz    schedule 08.04.2021
comment
ฉันได้รับข้อผิดพลาดนี้เมื่อฉันเพิ่มคำนำลงในไฟล์ rmd ของฉัน มีเหตุผลใดที่ทำให้เป็นเช่นนี้ processing file: report.Rmd output file: report.knit.md ! LaTeX Error: Missing \begin{document}. Error: LaTeX failed to compile report.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See report.log for more info. In addition: Warning message: In has_crop_tools() : Tool(s) not installed or not in PATH: ghostcript -> As a result, figure cropping will be disabled. Execution halted - person Tanga94; 10.04.2021
comment
คุณสามารถแสดงไฟล์ .log ที่สมบูรณ์ได้หรือไม่ - person samcarter_is_at_topanswers.xyz; 10.04.2021
comment
เพิ่มแล้ว @samcarter_is_at_topanswers.xyz ฉันยังไม่ได้เปลี่ยนแปลงอะไรในรหัสของคุณ แต่ฉันเดาว่าฉันควรเปลี่ยน example-image ในคำนำของคุณเป็นเส้นทางไฟล์สำหรับโลโก้ของฉัน - person Tanga94; 10.04.2021
comment
@ Tanga94 example-image เป็นรูปภาพที่ควรรวมอยู่ในการแจกแจงข้อความที่สมบูรณ์ทั้งหมด คุณสามารถแทนที่ได้ แต่ข้อผิดพลาดจะดูแตกต่างออกไป ฉันคิดว่าปัญหาอาจเกิดจากเวอร์ชัน fancyhdr ของคุณ ซึ่งดูเหมือนว่าจะไม่อัปเดต - person samcarter_is_at_topanswers.xyz; 10.04.2021
comment
@ Tanga94 สำหรับการทดสอบอย่างรวดเร็ว ให้ลองลบบรรทัด \fancypagestyle{plain}[fancy]{} ซึ่งจะไม่เพิ่มส่วนหัวในหน้าแรก แต่ควรใช้ได้กับ fancyhdr เวอร์ชันเก่าด้วย - person samcarter_is_at_topanswers.xyz; 10.04.2021
comment
ขอบคุณมาก มันได้ผล ฉันก็เลยเริ่มใช้งานได้เลย! ฉันจะลองเล่นกับมันดูว่าฉันจะทำให้มันตรงตามข้อกำหนดของฉันได้ไหม ฉันยอมรับคำตอบของคุณเป็นวิธีแก้ปัญหาแล้ว :) - person Tanga94; 11.04.2021