고양이 예

고양이 예

나는 "page 2 of 3" 등을 읽는 바닥글을 갖기 위해 fancyheadings 패키지를 사용했는데, 몇 가지 그림을 그리기 위해 tikz 패키지를 추가하기 전까지는 잘 작동했습니다. 이제 바닥글은 문서의 나머지 부분과 구분하는 수평선을 제외하고는 전혀 표시되지 않습니다. 바닥글을 즐기고 tikz로 그림을 그릴 수 있는 방법이 있나요?

내 코드는 다음과 같습니다.

    \documentclass[12pt,letterpaper]{article}
    \setlength{\textwidth}{6.5in}
    \setlength{\textheight}{9.5in}
    \setlength{\oddsidemargin}{-.25in}
    \setlength{\evensidemargin}{-.25in}
    \setlength{\topmargin}{-.25in}
    \usepackage{fancyhdr}
    \usepackage{lastpage}
    \pagestyle{fancy}
    \cfoot{Page \thepage\ of \pageref{LastPage}}
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{1pt}
    %\usepackage{tikz}
    \begin{document}

    \begin{center}
    \Huge  {\bf More Sets}\\
    \end{center}
    \end{document}

\usepackage{tikz}를 주석 처리하여 컴파일하면 원하는 결과를 얻을 수 있습니다. 성공!

그러나 \usepackage{tikz}의 주석 처리를 제거하면 막대가 여전히 아래쪽에 있고 페이지 번호를 찾을 수 없습니다. 여기에 이미지 설명을 입력하세요

답변1

아니요. 완전히 호환됩니다 fancyhdr. tikz나는 문서에서 항상 두 가지를 모두 사용합니다.

그러나 어쨌든 그냥 로드 fancyhdr하므로 직접 로드하는 것이 fancyheadings더 투명하므로 더 좋습니다.

원한다면 의 fancyhdr머리글 및 바닥글 설정 매크로에 대한 인수에 TikZ 그림을 사용할 수도 있습니다. TikZ 고양이가 등장하는 예는 아래를 참조하세요.

귀하가 겪고 있는 문제는 TikZ가 없으면 귀하가 생성하는 문서가 A4 용지의 US Letter 레이아웃과 같은 것을 사용하고 있다는 사실로 인해 발생합니다. A4 용지는 US Letter보다 키가 커서 공간이 더 많습니다. 하지만 기본적으로 모든 일이 여기저기서 끝나게 됩니다.

letterpaperTikZ를 로드하면 클래스에서 가져오는 항목(무엇인지 확실하지 않음)이 로드 되고 이에 따라 용지가 설정됩니다. 이제 편지지에 편지지 레이아웃이 생겼습니다. 그러나 이제 종이는 더 짧아졌고 기본적으로 공간도 충분하지 않습니다.

이 문제를 해결하는 가장 좋은 방법은 로드하는 것입니다 . 그러나 레이아웃 크기를 수동으로 조정하지 말고 패키지 또는 구성 옵션을 geometry제공해야 합니다 .geometry

예를 들어:

\documentclass[12pt,letterpaper]{article}
\usepackage{geometry}
\geometry{width=6.5in,height=9.5in,left=.75in,top=.75in}
\usepackage{fancyhdr}
\usepackage{lastpage}
\pagestyle{fancy}
\cfoot{Page \thepage\ of \pageref{LastPage}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{1pt}
\usepackage{tikz}
\begin{document}
\begin{center}
  \Huge\bfseries More Sets
\end{center}
\end{document}

20년 이상 전에 더 이상 사용되지 않았 \bf으며 그 날짜 이후에는 LaTeX 문서에서 사용하면 안 됩니다. 시작하는 경우 또는 유사 항목을 \documentclass사용하면 안 됩니다 \bf.

또한 \Huge {abc}d와 동일하다는 점도 참고하세요 \Huge abcd. \Huge논쟁을 벌이지 않습니다. 처럼 \bfseries스위치입니다.

어쨌든 결과는 다음과 같습니다.

고양이가 부족하다

고양이는 부재로 인해 눈에 띄지만 모든 것을 가질 수는 없으며 이제 모든 것이 페이지에 표시됩니다.

그러나 fancyhdr다음과 같이 실제로 적합하지 않습니다.

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

geometry따라서 의 인터페이스를 사용하여 레이아웃을 다시 변경해야 합니다 .

\documentclass[12pt,letterpaper]{article}
\usepackage{geometry}
\geometry{width=6.5in,height=9.5in,left=.75in,top=.75in,headheight=15pt}
\usepackage{fancyhdr}
\usepackage{lastpage}
\pagestyle{fancy}
\cfoot{Page \thepage\ of \pageref{LastPage}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{1pt}
\usepackage{tikz}
\begin{document}
\begin{center}
  \Huge\bfseries More Sets
\end{center}
\end{document}

최종 결과:

조정된 헤더 높이

고양이 예

예를 들어:

TikZ 고양이는 머리글, 바닥글 등 어디든 갈 수 있습니다.

\documentclass[welsh,british]{article}
\usepackage[rgb,x11names,dvipsnames,svgnames]{xcolor}
\usepackage{kantlipsum,tikz,fancyhdr,geometry,babel}
\geometry{headheight=40pt,footskip=60pt}
\usetikzlibrary{cathod,trambws,positioning,decorations.footprints}
\colorlet{cath1}{blue!50!gray!75}
\colorlet{cath2}{cath1!50}
\colorlet{cath3}{DarkOrchid4}
\colorlet{cath4}{cath3!50}
\colorlet{lliw llygaid1}{Yellow1}
\colorlet{lliw llygaid2}{DarkOrange3}
\colorlet{lliw llygaid3}{Chartreuse1}
\colorlet{lliw llygaid4}{Green4}
\colorlet{lliw trwyn1}{LightPink2}
\colorlet{lliw trwyn2}{HotPink2}
\colorlet{cath5}{LavenderBlush3}
\colorlet{cath6}{LavenderBlush4}
\pagestyle{fancy}
\fancyhf{}
\fancyhf[lh]{%
  \tikz{\pic [xscale=-1] {cath eistedd={stripiau=cath1, llenwi=cath2, llygaid mewnol=lliw llygaid3, llygaid allanol=lliw llygaid4, trwyn=lliw trwyn1, maint=1mm}};}%
}
\fancyhf[rh]{%
  \tikz{\pic at (57.5mm,0) {cath eistedd={stripiau=cath3, llenwi=cath4, llygaid mewnol=lliw llygaid1, llygaid allanol=lliw llygaid2, trwyn=lliw trwyn2, maint=1mm}};}%
}
\fancyhf[cf]{%
  \begin{tikzpicture}
    \pic [xscale=-1] at (3,1.4) {cath eistedd={stripiau=cath6,llenwi=cath5,llygaid mewnol=lliw llygaid3,llygaid allanol=lliw llygaid4,trwyn=lliw trwyn2, maint=1mm}};
    \draw [line width=.5pt, rounded corners=.25pt, draw=Chocolate4] (3.5,.7) rectangle (3.6,.75);
    \draw [rounded corners=1pt, inner color=Chocolate3!95, outer color=Chocolate3, draw=Chocolate4, line width=.5pt] (3.35,.4) rectangle (3.75,.7);
    \draw [decorate, fill=Chocolate4, draw=Chocolate4, decoration={footprints, foot of=felis silvestris, foot length=.35pt, stride length=.4pt, foot angle=-30}] (3.625,.55) -- (3.525,.6);
    \draw [line width=1pt, line cap=round, draw=OliveDrab4] (4.75,1.85) -- (4.75,.25) coordinate [pos=.04] (a);
    \node [double=Green2, double distance=.25pt, draw=Green4!50!black, line width=.25pt, rounded corners=1pt, text=white, inner sep=1pt, fill=Green4, font=\sffamily\tiny\bfseries, align=center, anchor=north east] at ([xshift=1pt]a) {BUS STOP\\{\selectlanguage{welsh}SAFLE BYSIAU}};
  \pic [lliw y tram=Red2, lliw ffenestri=Snow3] at (-2,0) {tram=5};
  \end{tikzpicture}
}
\begin{document}
\kant[1-6]
\end{document}

관련 정보