我有以下情况,我不知道如何纠正它,我希望当使用 tikz 时,我希望它打印在正确的位置,即页脚。
\documentclass{book}
\usepackage[showframe]{geometry}
\usepackage[spanish]{babel}
\usepackage{fancyhdr} % Required for custom headers
\usepackage[dvipsnames, x11names,table]{xcolor}
\usepackage{tikz}
\pagestyle{fancy}
\fancypagestyle{plain}{%
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
% \renewcommand{\footrulewidth}{1pt}
\fancyfoot[L]{Muni NC}
\fancyfoot[R]{
\begin{tikzpicture}[baseline={(current bounding box.north)}]
\draw[Red,line width=5pt,rotate=90] (-3mm,2mm) -- (4mm,2mm);
\node[anchor=west] at (0mm,0) {\large \bfseries\ttfamily \thepage};
\end{tikzpicture}
}
}
\begin{document}
\chapter{Chapte title}
\section{Example section}
\end{document}
你能帮我吗
答案1
tikz 基线和节点锚点都应设置为。在左脚后base
添加命令以显示对齐。\hrulefill
\documentclass{book}
\usepackage{geometry}
\usepackage[spanish]{babel}
\usepackage{fancyhdr} % Required for custom headers
\usepackage[dvipsnames, x11names,table]{xcolor}
\usepackage{tikz}
\pagestyle{fancy}
\setlength{\footskip}{26.01695pt} %avoid warning
\fancypagestyle{plain}{%
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
%\renewcommand{\footrulewidth}{1pt}
\fancyfoot[L]{Muni NC\hrulefill}
\fancyfoot[R]{%
\begin{tikzpicture}[baseline={(current bounding box.base)}]
\draw[Red,line width=5pt] (0,0) -- (0,7mm);
\node[anchor=base] at (14pt,0) {\large \bfseries\ttfamily \thepage};
\end{tikzpicture}%
}
}
\begin{document}
\chapter{Chapte title}
\section{Example section}
\end{document}
输出: