TikZ のヘッダー ページ ブック

TikZ のヘッダー ページ ブック

この図はどうやって描けばいいのでしょうか?

ここに画像の説明を入力してください

ここに画像の説明を入力してください

\documentclass[12pt]{book}

\usepackage[top=25mm,bottom=25mm,left=25mm,right=25mm]{geometry}

\usepackage[all]{background}

\usepackage{ptext,xcolor}
%\usepackage{showframe}

\usepackage{tikz}
\usetikzlibrary{calc} 

\usepackage{changepage}
\strictpagecheck


\usepackage{fancyhdr}
\fancyhf{}
\fancyhead[LO,RE]{\thepage}
\fancyhead[LE]{عنوان کتاب}
\fancyhead[RO]{\leftmark}
\renewcommand{\headrulewidth}{0pt}
\pagestyle{fancy}


\usepackage{xepersian}
\settextfont[Scale=1.2]{Yas} 
\linespread{1.5}

\newcommand*{\vsp}{2cm}
\newcommand*{\hsp}{2.5cm}

\newcommand{\MyTikzLogo}{% 
\begin{tikzpicture}[remember picture,overlay]
\checkoddpage
\ifoddpage
    \draw  [color=magenta,line width=1mm] ($(\paperwidth+\hsp,-\vsp)$) --($(\hsp,-\vsp)$);
\else
    \draw  [color=cyan,line width=1mm] ($(0,-\vsp)$) --($(\paperwidth-\hsp,-\vsp)$);
\fi
 \end{tikzpicture}
}

\SetBgContents{\MyTikzLogo}
\SetBgPosition{current page.north west}
\SetBgOpacity{1.0}
\SetBgAngle{0.0}
\SetBgScale{1.0}

\begin{document}

\chapter{titel}

\section{sec }

\ptext[1-40]


\end{document}

答え1

この場合、背景は使用しません。私の提案は、ページ番号を印刷するコマンドに装飾を貼り付け、tikzpicture制御された境界ボックスを使用するというものです。

以下はスタートです --- 上の部分だけ作成しましたが、下の部分はもっと簡単なはずです。Parsi のものを削除しました (フォントを持っていません)。

\documentclass[12pt]{book}

\usepackage[top=25mm,bottom=25mm,left=25mm,right=25mm,
    headheight=40pt]{geometry}

\usepackage{xcolor}
\usepackage{lipsum}

\usepackage{tikz}
\usetikzlibrary{calc, shapes.geometric} 

\usepackage{changepage}
\strictpagecheck

\usepackage{fancyhdr}
\fancyhf{}
\fancyhead[LO,RE]{\myfancynum}
\fancyhead[LE]{book title}
\fancyhead[RO]{\leftmark}
\renewcommand{\headrulewidth}{0pt}
\pagestyle{fancy}

\linespread{1.5}

\newcommand{\myfancynum}{%
    \begin{tikzpicture}
        \path (0,0) [use as bounding box]
        node[diamond, draw=cyan, inner sep=0pt, minimum size=32pt] (pageno) {\thepage} ;
    \checkoddpage\ifoddpage
    % 36pt = 32pt + 4pt +4pt; 
    \path (pageno.west) node[fill=cyan, fill opacity=0.4, diamond, inner sep=0pt, minimum size=16pt] {};
    \draw[cyan] (pageno.north) ++(0, +4pt) -- ++(40pt, -40pt) -- ++(\linewidth,0);
    \draw[cyan] (pageno.east) ++(4pt, 0) -- ++(-40pt, -40pt) -- ++(0, -4cm);
    \else
    \path (pageno.east) node[fill=cyan, fill opacity=0.4, diamond, inner sep=0pt, minimum size=16pt] {};
    \draw[cyan] (pageno.north) ++(0, +4pt) -- ++(-40pt, -40pt) -- ++(-\linewidth,0);
    \draw[cyan] (pageno.west) ++(-4pt, 0) -- ++(40pt, -40pt) -- ++(0, -4cm);
    \fi
    \end{tikzpicture}%
}

\begin{document}

\chapter{A chapter}

\section{A section}

\lipsum[1-40]

\end{document}

入手方法:

対称ページの上部

ここでの秘訣は、画像のサイズがページ番号の付いたダイヤモンドのサイズとちょうど一致するようにすることです (さらに必要な場合は、use as bounding boxこれを使用できます)。scopefancyhdr

当然、ヘッダーのサイズも大きくする必要がありました。これらの定数をすべて使用しないようにコードを整理する必要がありますが、それは読者の課題として残しておきます...

新しい形で更新します --- これはアンカーの使用方法を示しているので、非常に教育的だと思います... 変更:

\newcommand{\myfancynum}{%
    \begin{tikzpicture}
        % this trick is used to have the bounding box centered on the number, but
        % the real drawing (the star) hanging down (thanks to anchor=north).
        % By default, fancyhdr will line the baseline of this graph (that for it is
        % just the pagenumber) to the chapter-section-title whatever info it prints in
        % the header. 
        % To see how fancyhdr lines up things, change this \path to a \draw
        \path [use as bounding box] (-16pt,16pt) rectangle (16pt,-16pt);
            \path node[star, star points=8, star point ratio=1.3, draw=cyan,
                inner sep=0pt, minimum size=32pt, anchor=north] (pageno) {\thepage} ;
    \checkoddpage\ifoddpage
    % line lengths are adjusted by hand. Probably a bit of math could fix this, but well...
    \path (pageno.west) node[fill=cyan, fill opacity=0.4, diamond, inner sep=0pt, minimum size=16pt] {};
    \draw[cyan] (pageno.inner point 7) -- ++(44pt,0);
    \draw[cyan] (pageno.east) -- ++(+40pt, 0) -- ++(4pt,-4pt) -- ++({\linewidth-48pt},0);
    \draw[cyan] (pageno.outer point 6) -- ++(\linewidth,0);
    \draw[cyan] (pageno.west) -- ++(-8pt, -8pt) -- ++(0, -4cm);
    \else
    \path (pageno.east) node[fill=cyan, fill opacity=0.4, diamond, inner sep=0pt, minimum size=16pt] {};
    \draw[cyan] (pageno.inner point 2) -- ++(-44pt,0);
    \draw[cyan] (pageno.west) -- ++(-40pt, 0) -- ++(-4pt,-4pt) -- ++({-\linewidth+48pt},0);
    \draw[cyan] (pageno.outer point 4) -- ++(-\linewidth,0);
    \draw[cyan] (pageno.east) -- ++(+8pt, -8pt) -- ++(0, -4cm);
    \fi
    \end{tikzpicture}%
}

あなたに与えるもの:

ここに画像の説明を入力してください

関連情報