chapter20150426205547代码如下:

\documentclass{book}
\usepackage{lipsum}
\usepackage[
  a5paper,
%  showframe,
]{geometry}

\usepackage{fancyhdr}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{picture}
\usepackage{etoolbox}

% Remove prefix "Chapter" and chapter number
\makeatletter
\patchcmd{\ps@fancy}{\@chapapp\ \thechapter. \ }{}%
  {}{\errmessage{Cannot patch \protect\ps@headings}}
\makeatother

\newlength{\myouterheadwidth}
\setlength{\myouterheadwidth}{3em}
\newlength{\myouterheadsep}
\setlength{\myouterheadsep}{2em}

\pagestyle{fancy}
\fancyhf{}
\renewcommand*{\headrulewidth}{0pt}
\renewcommand*{\footrulewidth}{0pt}
\fancyfoot[RO]{%
  \hfill
  \rlap{%
    \kern\myouterheadsep
    \myouterhead
  }%
}
\fancyfoot[LE]{%
  \llap{%
    \myouterhead
    \kern\myouterheadsep
  }%
}
\newcommand*{\myouterhead}{%
  \sffamily\bfseries\Large
  \color{white}%
  \begin{picture}(0,0)
    \put(0, \dimexpr \footskip + \textheight + \headheight + \headsep
                     + \topmargin + 1in - \paperheight\relax){%
      \textcolor{lightgray}{\rule{\myouterheadwidth}{\paperheight}}%
    }%
    \put(0,\dimexpr\footskip + \textheight\relax){%
      \makebox(\myouterheadwidth,0)[t]{%
        \rotatebox{\ifodd\value{page}-\fi 90}{\leftmark}%
      }%
    }%
    \put(0,0){%
      \makebox(\myouterheadwidth,0)[b]{\thepage}%
    }%
  \end{picture}%
  \kern\myouterheadwidth
}

% Using same page style for chapter start pages, which use \pagestyle{plain}
\makeatletter
\let\ps@plain\ps@fancy
\makeatother

\begin{document}
\chapter{Introduction}
\lipsum[1-4]
\end{document}

选自:http://tex.stackexchange.com/questions/192141/colored-margin-with-vertical-text

点赞(0)

评论列表 共有 1 条评论

扬斯克 2年前 回复TA

运行了但是报错是什么原因啊?

立即
投稿

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部