LaTeX forum ⇒ Page LayoutProblems with header in two-column page layout

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
GL_n
Posts: 1
Joined: Sun Jul 09, 2017 3:00 pm

Problems with header in two-column page layout

Postby GL_n » Sun Jul 09, 2017 3:33 pm

I want to design a dictionary via using the two-column page layout, but some unexpected problems occur when formatting the header of pages. The troubles related with the header are described as follows:

    How to remove the column header at the beginning of every left column page? The image is in following:

https://i.stack.imgur.com/2RYIB.png or click on this web-link https://tex.stackexchange.com/questions/378757/problems-with-header-in-two-column-page-layout

    How to add bookmarks (switch to every capital letter, such as A, B, C, etc. at the head-position of every words group) into the output PDF document. To be precise, when I open the output through Acrobat Adobe Pro I couldn't find the bookmarks on the left-hand side. I have already loaded the package hyperref, however, it didn't work.

The minimal working example is:

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \documentclass[twoside,10pt,twocolumn]{book}
  2. \usepackage{lipsum}
  3. \usepackage{adforn}
  4. \usepackage[top=2.0cm, bottom=3.5cm, left=2cm, right=2cm]{geometry}%default top=1.5cm
  5. \usepackage{fancyhdr}
  6. \usepackage[icelandic, czech, english]{babel}
  7. \usepackage[utf8x,utf8]{inputenc}
  8. \usepackage{color}
  9. \definecolor{marron}{RGB}{60,30,10}
  10. \definecolor{darkblue}{RGB}{0,0,80}
  11. \definecolor{lightblue}{RGB}{80,80,80}
  12. \definecolor{darkgreen}{RGB}{0,80,0}
  13. \definecolor{darkgray}{RGB}{0,80,0}
  14. \definecolor{darkred}{RGB}{80,0,0}
  15. \definecolor{shadecolor}{rgb}{0.97,0.97,0.97}
  16. \usepackage[T1]{fontenc}
  17. \usepackage{hanging}
  18. \usepackage{tikz}
  19. \usetikzlibrary{calc}
  20.  
  21. %---------------------------------------------------------------------------------------------%
  22. \usepackage{fourier-orns}
  23. \newcommand{\ornpar}{\noindent \textcolor{darkgray}{ \raisebox{-1.9pt}[10pt][10pt]{\leafright} \hrulefill \raisebox{-1.9pt}[10pt][10pt]{\leafright \decofourleft \decothreeleft \aldineright \decotwo \floweroneleft \decoone}}}
  24. \newcommand{\ornimpar}{\textcolor{darkgray}{\raisebox{-1.9pt}[10pt][10pt]{\decoone \floweroneright \decotwo \aldineleft \decothreeright \decofourright \leafleft} \hrulefill \raisebox{-1.9pt}[10pt][10pt]{\leafleft}}}
  25. %---------------------------------------------------------------------------------------------%
  26.  
  27.  
  28. %---------------------------------------------------------------------------------------------%
  29. \newcommand\entry[4][]{\hangpara{2em}{1}{\fontfamily{phv}\selectfont{\textbf{{#2}}}}\ #4\
  30. #3 \ifx\relax #1 \relax \markboth{#2}{#2}\else\markboth{#1}{#1}\fi
  31. \vspace*{5pt}\par} \nopagebreak[4]
  32.  
  33. \newcommand*{\dictchar}[1]{\centerline{\LARGE\textbf{#1}}\vspace*{10pt}\par}
  34. %---------------------------------------------------------------------------------------------%
  35.  
  36.  
  37.  
  38.  
  39. %---------------------------------------------------------------------------------------------%
  40. % use fancyhdr or whatever you want to add
  41. % the boxes to the header to make them appear
  42. % on every page
  43.  
  44. % new counter to hold the current number of the
  45. % letter to determine the vertical position
  46. \newcounter{letternum}
  47. % newcounter for the sum of all letters to get
  48. % the right height of a box
  49. \newcounter{lettersum}
  50. \setcounter{lettersum}{26}
  51. % some margin settings
  52. \newlength{\thumbtopmargin}
  53. \setlength{\thumbtopmargin}{1cm}
  54. \newlength{\thumbbottommargin}
  55. \setlength{\thumbbottommargin}{3cm}
  56. % calculate the box height by dividing the page height
  57. \newlength{\thumbheight}
  58. \pgfmathsetlength{\thumbheight}{%
  59. (\paperheight-\thumbtopmargin-\thumbbottommargin)%
  60. /%
  61. \value{lettersum}
  62. }
  63. % box width
  64. \newlength{\thumbwidth}
  65. \setlength{\thumbwidth}{1.5cm}
  66. % style the boxes
  67. \tikzset{
  68. thumb/.style={
  69. fill=black!50!red,
  70. text=white,
  71. minimum height=\thumbheight,
  72. text width=\thumbwidth,
  73. outer sep=0pt,
  74. font=\sffamily\bfseries,
  75. }
  76. }
  77. \newcommand{\oddthumb}[1]{%
  78. % see pgfmanual.pdf for more information about this part
  79. \begin{tikzpicture}[remember picture, overlay]
  80. \node [thumb,text centered,anchor=north east,] at ($%
  81. (current page.north east)-%
  82. (0,\thumbtopmargin+\value{letternum}*\thumbheight)%
  83. $) {#1};
  84. \end{tikzpicture}
  85. }
  86. \newcommand{\eventhumb}[1]{%
  87. % see pgfmanual.pdf for more information about this part
  88. \begin{tikzpicture}[remember picture, overlay]
  89. \node [thumb,text centered,anchor=north west,] at ($%
  90. (current page.north west)-%
  91. (0,\thumbtopmargin+\value{letternum}*\thumbheight)%
  92. $) {#1};
  93. \end{tikzpicture}
  94. }
  95.  
  96. % create a new command to set a new lettergroup
  97. \newcommand{\lettergroup}[1]{%
  98.  
  99. \fancypagestyle{chapterstart}{%
  100. \fancyhf{}
  101. \pagestyle{fancy}
  102. \renewcommand{\headrulewidth}{0pt}
  103. \chead{\oddthumb{#1}}% chapters start only on odd pages
  104. \cfoot{\thepage}
  105. }
  106.  
  107. %\renewcommand{\headrulewidth}{0pt}
  108. %\fancyhead{}
  109.  
  110. \fancyhead[LO]{ \raisebox{1em}{ \fontfamily{phv} \selectfont{\textbf{\rightmark}} } \oddthumb{#1}}
  111. \fancyhead[RE]{ \raisebox{1em}{ \fontfamily{phv} \selectfont{\textbf{\leftmark}} } \eventhumb{#1}}
  112.  
  113.  
  114.  
  115. \fancyhead[LE]{{\fontfamily{phv}\selectfont{\textbf{\raisebox{1em}{\rightmark}}}}}
  116. \fancyhead[CO,CE]{\headrule}
  117. \fancyhead[RO]{{\fontfamily{phv}\selectfont{\textbf{\raisebox{1em} {\leftmark}}}}}
  118.  
  119. % step the counter of the letters
  120. \stepcounter{letternum}%
  121. }
  122. %---------------------------------------------------------------------------------------------%
  123.  
  124.  
  125.  
  126. %---------------------------------------------------------------------------------------------%
  127. \makeatletter%标题的headrule
  128. \def\headrule{ { \color{darkgray} \raisebox{-2.1pt}[10pt][10pt]{\leafright} \hrulefill \raisebox{-2.1pt}[10pt][10pt]{~~~\decofourleft \decotwo \decofourright~~~} \hrulefill \raisebox{-2.1pt}[10pt][10pt]{ \leafleft} } }
  129. \makeatother
  130.  
  131. % \renewcommand\headrule{ {\color{darkgray}\raisebox{-2.1pt}[10pt][10pt]{\leafright} \hrulefill \raisebox{-2.1pt}[10pt][10pt]{~~~\decofourleft \decotwo \decofourright~~~} \hrulefill \raisebox{-2.1pt}[10pt][10pt]{ \leafleft}} }
  132.  
  133. % % \renewcommand\headrule{{\leafright} \hrulefill
  134. % % \raisebox{-2.1pt}[10pt][10pt]{\quad\decofourleft\decotwo\decofourright \quad}{\hrulefill}\leafleft}
  135. %---------------------------------------------------------------------------------------------%
  136.  
  137.  
  138.  
  139.  
  140. %---------------------------------------------------------------------------------------------%
  141. \fancypagestyle{basicstyle}{%
  142. \fancyhf{}
  143. \renewcommand{\headrulewidth}{0.4pt}
  144. \renewcommand{\footrulewidth}{0pt}
  145. \fancyhead[LE,RO]{\textbf{\chaptitle}}
  146. \fancyhead[LO,RE]{\textbf{\thepage}}
  147. \fancyfoot[LE,RO]{\thepage}}
  148.  
  149.  
  150.  
  151. \fancypagestyle{dictstyle}{%
  152. \fancyhf{}
  153.  
  154.  
  155. % \fancyhead[LE,LO]{{\fontfamily{phv}\selectfont{\textbf{\raisebox{1em} {\rightmark}}}}}
  156. % \fancyhead[CO,CE]{\headrule}%\thepage,\headrule
  157. % \fancyhead[RE,RO]{{\fontfamily{phv}\selectfont{\textbf{\raisebox{1em} {\leftmark}}}}}
  158. \renewcommand{\headrulewidth}{0pt}
  159. \fancyhead{}
  160.  
  161. \fancyfoot[LO]{
  162. \ornimpar \\ \hfill \textcolor{darkgray}{\large \leafNE ~~~ \raisebox{-0.35em}{\textsf{\textbf{\thepage}}} } }
  163.  
  164. \fancyfoot[RE]{\ornpar \\ \textcolor{darkgray}{\large \raisebox{-0.35em} {\textsf{\textbf{\thepage}}} ~~~ \reflectbox{\leafNE}} \hfill }
  165. }
  166.  
  167.  
  168. \setlength{\columnsep}{20pt}
  169. \setlength{\columnseprule}{0pt}
  170. %---------------------------------------------------------------------------------------------%
  171.  
  172. \usepackage{hyperref}
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180. %\pagestyle{basicstyle}
  181.  
  182.  
  183. %----------------------------------------------------------------------------------------------%
  184.  
  185. \begin{document}
  186. %\maketitle
  187. \begin{titlepage}
  188. \centering\Huge \adforn{26}\adforn{21}\quad\adforn{11}\quad\adforn{49} \adforn{54}
  189.  
  190. \vspace*{2em}\centering\bf
  191. \texttt{My Dictionary}\par
  192.  
  193. \vspace{2em}
  194. {\hfill\centering \large{The Author}\hfill}
  195. \end{titlepage}
  196.  
  197. \newpage
  198. %\adforn{21}\quad\adforn{11}\quad\adforn{49}
  199. %----------------------------------------------------------------------------------------------%
  200. \twocolumn
  201. \fancyhf{}
  202. \pagestyle{dictstyle}%dictstyle
  203.  
  204. \lettergroup{A}
  205. \dictchar{A}
  206. % \hyperlink{A}{\dictchar{A}}
  207. \entry[headwords]{headwords}{translations}{\textsf{/yinfu/}}
  208. \entry[headwords2]{headwords2}{translations2}{/yinfu/}
  209. \entry[philosophy]{philosophy} {Lorem ipsum dolor sit amet, consectetuer
  210. adipiscing elit. Ut purus elit, vestibulum ut, \emph{plac- erat ac}}{/yinfu/}
  211. \entry[Math]{Math}{Lorem ipsum dolor sit amet}{/yinfu/}
  212. \entry[Physics]{Physics}{\lipsum[1-2]}{/yinfu/}
  213. \entry[Nature]{Nature}{\lipsum}{/yinfu/}
  214. \clearpage
  215.  
  216.  
  217. \lettergroup{B}
  218. \dictchar{B}
  219. \entry[headwords]{headwords}{translations}{/yinfu/}
  220. \entry[headwords2]{headwords2}{translations2}{/yinfu/}
  221. \clearpage
  222.  
  223. \lettergroup{C}
  224. \dictchar{C}
  225. \entry[headwords]{headwords}{translations}{/yinfu/}
  226. \entry[headwords2]{headwords2}{translations2}{/yinfu/}
  227. \clearpage
  228. \end{document}

Tags:

User avatar
Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sun Jul 09, 2017 6:48 pm

The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

User avatar
Stefan Kottwitz
Site Admin
Posts: 9444
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Mon Jul 10, 2017 4:45 am

Since the question has just been copied here, at least I wait until the discussion is finished on the other site.

Stefan
Site admin


Return to “Page Layout”

Who is online

Users browsing this forum: No registered users and 4 guests