旋转的、在右边距运行的文本?

旋转的、在右边距运行的文本?

我想要放置一些(大)文本,旋转-90度并运行右边距。

审查后章节标题位于边缘的旋转垂直框中和有些相关的(尽管是表格而不是标准文本)帖子侧边距中的文本旋转,这些并不是我所需要的。

有人建议我将其分离为一个独立的问题,因此我发表了此帖。

答案1

这是一种tikz + fancyhdr完成任务的方法。这里文本会自动放在奇数页的右侧和偶数页的左侧。

\documentclass[12pt,x11names,svgnames,twoside]{article}
\usepackage{tikz}
\usepackage{calc}
\usetikzlibrary{shapes.misc}
\usepackage{varwidth}
\usepackage{lipsum,fancyhdr}
\usepackage[a4paper,bindingoffset=.2in,left=1in,right=1in,top=1in,bottom=1in,headheight=\baselineskip,
   headsep=9mm,footskip=13mm,showframe]{geometry}

\fancypagestyle{sideheading}{%
  %% Clear all headers and footers
  \fancyhf{}
    %% Right headers on odd pages
  \fancyhead[RO]{%
      \begin{tikzpicture}[overlay,remember picture]
      \node[fill=NavyBlue!50,text=white,
      inner ysep=12pt, inner xsep=20pt,
      rounded rectangle,
      execute at begin node={\begin{varwidth}{\textheight}},%<====
      execute at end node={\end{varwidth}},
      rotate=90]
      at ([xshift=-13mm,yshift=0mm]current page.east)
      {\sffamily\nouppercase{Rotated, right margin running text which is
vertically centered and only for odd pages and this is going to be long}};
    \end{tikzpicture}
        }
        %% Left headers on even pages
\fancyhead[LE]{%
\begin{tikzpicture}[overlay,remember picture]
      \node[fill=magenta!50,text=white,
      inner ysep=12pt, inner xsep=20pt,
      rounded rectangle,
      execute at begin node={\begin{varwidth}{\textheight}},%<====
      execute at end node={\end{varwidth}},
      rotate=90]
      at ([xshift=13mm,yshift=0mm]current page.west)
      {\sffamily\nouppercase{Rotated, right margin running text which is
vertically centered and only for even pages}};
    \end{tikzpicture}
        }
  \renewcommand{\headrulewidth}{0pt}
  \renewcommand{\footrulewidth}{0pt}
  \fancyfoot[R]{\thepage}
}
% ----------------------------------------------------------------
\pagestyle{sideheading}
\begin{document}
\lipsum[1-12]
\end{document} 

在此处输入图片描述

答案2

背景包允许您将任何类型的材料(特别是文本)放置在文档部分或全部页面的任意给定位置,并让您完全轻松地控制要显示的材料的属性;这是一个简单的例子:

\documentclass{book}
\usepackage[centering]{geometry}
\usepackage{background}
\usepackage{lipsum}

\definecolor{textcolor}{HTML}{0A75A8}
\newcommand\Text{Some text that should appear in the right margin}

\SetBgColor{textcolor}
\SetBgOpacity{1}
\SetBgAngle{90}
\SetBgPosition{current page.center}
\SetBgVshift{-0.36\textwidth}
\SetBgScale{1.8}
\SetBgContents{\sffamily\Text}

\begin{document}

\lipsum[1-20]

\end{document}

在此处输入图片描述

答案3

您可以为这些特定页面重新定义新标题:

在此处输入图片描述

\documentclass{scrbook}
\usepackage{lipsum,xcolor}
\IfFileExists{rotating.sty}{\RequirePackage{rotating}}{}
\makeatletter
\def\even@samplepage{%
 \begin{picture}(0,0)
   \put(\Xeven,\Yeven){\turnbox{90}{\Huge \textcolor{\watermark@textcolor}{\watermark@text}}}
\end{picture}
}
%% Define a macro to print SAMPLE PAGE IN THE MARGIN
\def\odd@samplepage{%
 \begin{picture}(0,0)
   \put(\Xodd,\Yodd){\turnbox{90}{\Huge \textcolor{\watermark@textcolor}{\watermark@text}}}
 \end{picture}
}
%  Define the watermark words
\def\watermarktext#1{\gdef\watermark@text{\fontfamily{phv}\selectfont#1}}
\def\watermarktextcolor#1{\gdef\watermark@textcolor{#1}}
\watermarktext{SAMPLE PAGE}
\watermarktextcolor{purple}
% redefine headings
\def\ps@samplepage{\let\@mkboth\@gobbletwo
 \let\@oddhead\odd@samplepage\def\@oddfoot{\reset@font\hfil\thepage}
 \let\@evenhead\even@samplepage\def\@evenfoot{\reset@font\thepage\hfil}}
%%
%% We define two macros to position the watermark on the page
\def\Xodd{500}
\def\Xeven{-70}\def\Yeven{-810}
\def\Yeven{-\expandafter\strip@pt\textheight}
\let\Yodd\Yeven
\makeatother
\begin{document}
\pagestyle{samplepage}
\lipsum
\end{document}

您可以使用以下方式更改文本和颜色:

  \watermarktext{SAMPLE PAGE}
  \watermarktextcolor{blue}

答案4

在这个例子中,使用 background 包,我们可以将文本放置在页面的任何位置,这两个命令 \Texta 和 \Textb 分别表示奇数页和偶数页的文本。(fancy 可专门用于页眉和页脚)

代码

\documentclass[11pt,twoside,fleqn]{book} 
\usepackage[top=2.4cm,bottom=2.5cm,left=2.5cm,right=2.5cm,headsep=15pt,a4paper]{geometry} % page margins
\usepackage{lipsum} 
\usepackage{palatino} %font
\usepackage{xcolor} % for colors
%----------------------------------------
\usepackage{ifthen}
\definecolor{Extrem}{rgb}{0.79,0.06,0.28}
\usepackage[contents={},opacity=1,scale=1.5,color=Extrem]{background}
\newcommand\Texta{\bf\large text on the right side of the page} % odd page
\newcommand\Textb{\bf\large text on the left side of the page} % even pages
%-----------------------------------------
\AddEverypageHook{%
\ifthenelse{\isodd{\value{page}}}% impar
{\backgroundsetup{
angle=90,
position={0.72\textwidth,-0.3\textheight},
contents={\Texta}
}%
}%
%-----------------------------------------
{\backgroundsetup{
angle=90,
position={-0.05\textwidth,-0.3\textheight},
contents={\Textb}
}%
}%
\BgMaterial}
%-----------------------------------------
\begin{document}
\lipsum[1-20]
\end{document}

维斯塔普雷维亚

相关内容