FancyHdr

Piet van Oostrum ¾¾°¡ ¸¸µç PageStyle Á¤ÀÇ¿ë ÆÐÅ°Áö. fancyheadings ÆÐÅ°Áö°¡ ¹ßÀüÇÑ °ÍÀÌ´Ù.

¸ñÂ÷

1 FancyHdrÀÇ PageStyle
2 ´Ü¸é¿¡¼­ÀÇ »ç¿ë¹æ¹ý
3 ¾ç¸é¿¡¼­ÀÇ »ç¿ë¹æ¹ý
4 ¶°´Ù´Ï´Â°³Ã¼¿Í FancyHdr
5 FancyHdr¿Í \rightmark ¹× \leftmark
6 headrule°ú footrule ³Ö±â
7 ¸µÅ©

1 FancyHdrÀÇ PageStyle

\pagestyle{fancy}
¶Ç´Â
\pagestyle{fancyplain}
À¸·Î ÁöÁ¤Çϸé FancyHdr ÆÐÅ°ÁöÀÇ ÆäÀÌÁö ½ºÅ¸ÀÏ ¼³Á¤ ¸í·ÉÀÌ ÀÛµ¿ÇÑ´Ù.[1] ÀÌ ÆäÀÌÁö ½ºÅ¸ÀÏ ¼±¾ðÀÌ ¾øÀ¸¸é LaTeX ±âº»°ªÀÌ ¿©ÀüÈ÷ À¯È¿Çϱ⠶§¹®¿¡ Ŭ·¡½º ÆÄÀÏ¿¡¼­ Á¤ÇÑ ½ºÅ¸ÀÏÀ» µû¸¥´Ù. fancy¿Í fancyplainÀÇ Â÷ÀÌ´Â Àå(chapter)ÀÌ ½ÃÀÛÇÏ´Â ÆäÀÌÁöÀÇ ÂÊ ¸ð¾çÀ» fancyplainÀº Á¦¾îÇÒ ¼ö ÀÖ´Ù´Â Á¡ÀÌ´Ù. fancyplainÀ» ÆäÀÌÁö½ºÅ¸ÀÏ·Î ÇÑ °æ¿ì \fancyplain ¸í·ÉÀ» ¾µ ¼ö ÀÖ´Ù. \fancyplain ¸í·ÉÀÇ ¿ë¹ýÀº ´ÙÀ½°ú °°´Ù.[2]
\fancyplain{ÀåÀÌ ½ÃÀ۵Ǵ ¸é}{³ª¸ÓÁö ¸é}

LaTeXÀÇ \chapter ¸í·ÉÀº \thispagestyle{plain}¸¦ È£ÃâÇÑ´Ù. \fancyplain¿¡¼­ ÀåÀÌ ½ÃÀ۵Ǵ ¸éÀ» ºñ¿öµÎ¸é ±× È£ÃâÀ» ±×´ë·Î À¯ÁöÇÏ´Â °ÍÀÌ°í, ÀçÁ¤ÀÇÇÏ¸é ¹«½ÃÇÏ´Â °ÍÀÌ´Ù.

----
  • [1] ¸¸¾à º°µµÀÇ ¼³Á¤ÀÌ ¾øÀ¸¸é µðÆúÆ®·Î ¼³Á¤µÈ °ªµéÀÌ ÀÛµ¿ÇÑ´Ù. ¾Æ·¡ Ç׸ñ "headrule°ú footrule ³Ö±â" ÂüÁ¶
  • [2] »ç¿ë ¿¹´Â ¾Æ·¡ Ç׸ñ "¾ç¸é¿¡¼­ÀÇ »ç¿ë¹æ¹ý"¿¡ ÀÖ´Ù. ¸¸¾à º°µµ·Î ¼³Á¤ÇÏÁö ¾ÊÀ¸¸é "ÀåÀÌ ½ÃÀ۵Ǵ ¸é"°ú "³ª¸ÓÁö ¸é"°úÀÇ ±¸º°ÀÌ ¾ø¾îÁø´Ù.

2 ´Ü¸é¿¡¼­ÀÇ »ç¿ë¹æ¹ý

ÇÑ ÆäÀÌÁöÀÇ »ó´Ü¿¡ LHdr, CHdr, RHdr; ÇÏ´Ü¿¡ LFtr, CFtr, RFtr°¡ ÀÖ´Ù°í ÇÒ ¶§, ÀÌ °¢°¢À» ´ÙÀ½°ú °°ÀÌ Á¤ÀÇÇÒ ¼ö ÀÖ´Ù.
\pagestyle{fancy}
\lhead{}
\chead{}
\rhead{\bfseries ÁÁÀº ¹®¼­ ¸¸µé±â}
\lfoot{KTUG}
\cfoot{Happy TeXing!}%µðÆúÆ®´Â \thepage
\rfoot{\thepage}
\renewcommand{\headrulewidth}{.6pt}%µðÆúÆ®´Â .4pt
\renewcommand{\footrulewidth}{.4pt}%µðÆúÆ®´Â 0pt

<!> \headrulewidth¸¦ {0pt}·Î ÇÏ¸é ±¥¼±À» Áö¿ï ¼ö ÀÖ´Ù. ¹Ý´ë·Î \footrulewidth´Â µðÆúÆ®°¡ {0pt}À̱⠶§¹®¿¡ ±¥¼±À» º¸ÀÌ°Ô ÇÏ·Á¸é ±½±â¸¦ Á¤ÇÏ¿©¾ß ÇÑ´Ù. <!> ±¥¼±¿¡ ¿©À¯ºÐÀ» ÁÖ·Á ÇÒ ¶§´Â \addtolength\headheight{.5pt}¿Í °°Àº ¹æ½ÄÀ¸·Î headheight¸¦ ´Ã·ÁÁØ´Ù.

3 ¾ç¸é¿¡¼­ÀÇ »ç¿ë¹æ¹ý


´ÙÀ½°ú °°ÀÌ ÇÏ¸é ¾ç¸é ¸ÂÂÊÀ» © ¼ö ÀÖ´Ù.
\lhead[¦¼ö ¸é »ó´Ü ¿ÞÂÊ]{Ȧ¼ö ¸é »ó´Ü ¿ÞÂÊ}%
\lfoot[¦¼ö ¸é ÇÏ´Ü ¿ÞÂÊ]{Ȧ¼ö ¸é ÇÏ´Ü ¿ÞÂÊ}%
\chead[¦¼ö ¸é »ó´Ü Áß¾Ó]{Ȧ¼ö ¸é »ó´Ü Áß¾Ó}%
\cfoot[¦¼ö ¸é ÇÏ´Ü Áß¾Ó]{Ȧ¼ö ¸é ÇÏ´Ü Áß¾Ó}%¾ø¾Ö¸é ÂʹøÈ£°¡ ³ªÅ¸³­´Ù.
\rhead[¦¼ö ¸é »ó´Ü ¿À¸¥ÂÊ]{Ȧ¼ö ¸é »ó´Ü ¿À¸¥ÂÊ}%
\rfoot[¦¼ö ¸é ÇÏ´Ü ¿À¸¥ÂÊ]{Ȧ¼ö ¸é ÇÏ´Ü ¿À¸¥ÂÊ}%

\pagestyle{fancy} ¶Ç´Â \pagestyle{fancyplain}À» ¼±¾ðÇÏ¿© ÀÌ ¼³Á¤À» È°¼ºÈ­ÇÒ ¼ö ÀÖ´Ù. ÀÌµé ¼±¾ðÀÌ ¾øÀ¸¸é Ŭ·¡½º ÆÄÀÏ¿¡¼­ Á¤ÇÑ µðÆúÆ® ¼±¾ð(´ë°³ \pagestyle{plain}À¸·Î µÇ¾î ÀÖ´Ù.)À» µû¸¥´Ù.

¸í·É¾î \fancyplain{}{}ÀÇ »ç¿ë ¿¹
\pagestyle{fancyplain}
\renewcommand{\chaptermark}[1]{\markboth{\thechapter. #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\lhead[\fancyplain{}{\bfseries\thepage}]{\fancyplain{}{\bfseries\rightmark}}
\rhead[\fancyplain{}{\bfseries\leftmark}]{\fancyplain{}{\bfseries\thepage}}
\cfoot[]{}

(!) À§ÀÇ ¿¹Á¦´Â hoze¸Å´º¾óÇÁ·ÎÁ§Æ®¿¡¼­ °¡Á®¿Â °ÍÀÓ

¾ç¸é ¸ÂÂÊÀ» Á»´õ ¼¶¼¼ÇÏ°Ô Â¥·Á¸é, LO, CO, RO¿Í LE, CE, RE¸¦ °áÇÕÇÏ¿© ÁöÁ¤ÇÏ°í pagestyleÀº fancy ¶Ç´Â fancyplainÀ¸·Î ÇÑ´Ù. ¿¹ÄÁ´ë, \fancyfoot[LE,RO]´Â ¦¼ö ¸é(even, ¿ÞÂÊ ¸é)ÀÇ ¿ÞÂÊ footer¿Í Ȧ¼ö ¸é(odd, ¿À¸¥ÂÊ ¸é)ÀÇ ¿À¸¥ÂÊ ¾Æ·¡¸¦ µ¿ÀÏÇÏ°Ô ¼³Á¤ÇÏ´Â ¸í·ÉÀÌ´Ù.
\fancyhead{}  % clear all fields
\fancyhead[RO,LE]{\bfseries ÁÁÀº ¹®¼­ ¸¸µé±â}
\fancyfoot[LE,RO]{\thepage}
\fancyfoot[LO,CE]{KTUG}
\fancyfoot[CO,RE]{Happy TeXing!}
\renewcommand{\headrulewidth}{.6pt}%µðÆúÆ®´Â .4pt
\renewcommand{\footrulewidth}{.4pt}%µðÆúÆ®´Â 0pt

  • ¿©±â¼­ RE, LO, CE, CO¿¡ ÇØ´çÇÏ´Â \fancyhead ¸í·ÉÀº »ý·«µÇ¾ú´Ù. »ý·«µÇ¸é ¾ø´Â °ÍÀ¸·Î °£ÁÖÇÑ´Ù.
fancyhdrtest.jpg

4 ¶°´Ù´Ï´Â°³Ã¼¿Í FancyHdr

¶°´Ù´Ï´Â °³Ã¼°¡ ÆäÀÌÁöÀÇ ¸Ó¸®¿¡ ¿À´Â °æ¿ì ±¥¼±°ú ¸Â¹°·Á¼­ ÁÁÁö ¾ÊÀº °á°ú¸¦ °¡Á®¿À´Â °æ¿ì°¡ ÀÖ´Ù. ÀÌ·² ¶§´Â ´ÙÀ½°ú °°ÀÌ ÁöÁ¤ÇÏ´Â °ÍÀÌ ÇÑ ¹æ¹ýÀÌ´Ù.
\renewcommand{\headrulewidth}{\iffloatpage{0pt}{.4pt}}

5 FancyHdr¿Í \rightmark ¹× \leftmark

FancyHdr ÆÐÅ°Áö¿¡¼­ running head¿¡ ÀåÀý ¸í·ÉÀ» ºÙÀÌ·Á ÇÒ ¶§´Â ´ÙÀ½°ú °°ÀÌ ÇÑ´Ù.

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand\chaptermark[1]{\markboth{#1}{}}
\renewcommand\sectionmark[1]{\markright{\thesection~#1}}
\fancyhf{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}

<!> \rightmark¿Í \leftmark´Â \markboth³ª \markright ¸í·ÉÀ¸·Î ÁöÁ¤µÇ´Â °ªÀÌ´Ù. ÀÌ °ªÀ» Á÷Á¢ ¹Ù²ÙÁö ¾Êµµ·Ï ÇÑ´Ù.

6 headrule°ú footrule ³Ö±â

\documentclass[twoside]{book}
\usepackage{fancyhdr}
\pagestyle{fancy}

·Î ½ÃÀÛÇÏ´Â ¹®¼­¸¦ ÄÄÆÄÀÏÇϸé ÀÚµ¿À¸·Î headrule(header¿Í body »çÀÌÀÇ °¡·ÎÁÙ)°ú footrule(footer¿Í body »çÀÌÀÇ °¡·ÎÁÙ)ÀÌ µé¾î°£´Ù. ´Ù¸¸ footruleÀÇ ±½±â´Â µðÆúÆ®·Î 0pt·Î Á¤ÇØÁ® Àֱ⠶§¹®¿¡ º¸ÀÌÁö ¾Ê´Â´Ù. ÇÑÆí headruleÀº µðÆúÆ®·Î 0.4pt·Î Á¤ÇØÁ® ÀÖ´Ù. À̵éÀÇ ±½±â¸¦ °íÄ¡·Á¸é
\renewcommand{\headrulewidth}{0.6pt}%µðÆúÆ®´Â 0.4pt
\renewcommand{\footrulewidth}{0.4pt}%µðÆúÆ®´Â 0pt
¿Í °°ÀÌ ÀÔ·ÂÇÏ¸é µÈ´Ù. µû¶ó¼­ headruleÀÌ º¸ÀÌÁö ¾Ê°Ô ÇÏ·Á¸é 0pt·Î Á¤ÇÏ¸é µÈ´Ù. ÇÑÆí \rightmark, \leftmark µî Çì´õ¿¡ °ü·ÃÇÑ °ÍÀ» º°µµ·Î Á¤ÇÏÁö ¾ÊÀ¸¸é µðÆúÆ®·Î Á¤ÇÏ¿©Áø °Í(Ŭ·¡½º ¹× Ŭ·¡½º ¿É¼Ç¿¡ µû¶ó ´Ù¸£´Ù.)ÀÌ ³ªÅ¸³­´Ù. See KTUGOperate:16633

7 ¸µÅ©

Retrieved from http://faq.ktug.org/faq/FancyHdr
last modified 2006-01-08 13:53:52