如何不均匀地构造标题?

如何不均匀地构造标题?

下图显示了我正在处理的文本模板,它是使用 MWE 代码列表生成的。

在此处输入图片描述

我希望标题像下图所示那样“被框起来”,该图来自一份年度报告,可能是用 InDesign 排版的。与 Word 竞争很容易,但与 InDesign 竞争则有点困难。

在此处输入图片描述

如何使用 TikZ 或 Plain TeX 或 LaTeX 框住标题?请使用 LuaLateX 进行编译。代码有点粗糙,因为我正在参数化以处理通过 Lua 表设置的选项。

并非如此。

\documentclass{report}
\usepackage{fancyhdr,multicol,xcolor,calc,lipsum,lettrine}
\usepackage{fontspec}
\setmainfont{Arial}
\definecolor{spot}{rgb}{0,0.2,0.6}
\definecolor{theblue} {rgb}{0.02,0.04,0.48}
\definecolor{thegrey} {gray}{0.5}
\definecolor{thegray} {gray}{0.5}
\def\ZZZ{\phantom{ZZZ}}
\makeatletter
\def\HHUGE{\@setfontsize\HHUGE{58}{67}\selectfont}
\makeatother
\usepackage{tikz}
\usetikzlibrary{%
  calc,%
  backgrounds,%
  fadings,%
  positioning,%
   }

\usepackage[bottom=2.5cm]{geometry}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\pagestyle{fancy}
\thispagestyle{fancy}
\lhead{ %
 \begin{tikzpicture}[remember picture, overlay]
 \node [xshift=0cm,yshift=-1.5cm] at (current page.north west)
[text width=\paperwidth, text=white ,text height=1.5cm, shade, left color=spot!50!white, right color=white, above right]
{
\hbox to 1cm{\hfill \textbf{\thepage}}
\vspace*{1em}
};
 \end{tikzpicture}
 \color{white}}

\begin{document}

\makebox[\textwidth]{\hfill
\begin{minipage}{.8\textwidth}
\columnseprule2pt
\def\columnseprulecolor{\color{thegray}}
\columnsep22pt
\begin{multicols}{2}

\color{theblue}
\flushright
\Large
\obeylines
Over the last year we
have continued to
develop and improve the
range of funding schemes
we offer to meet the
needs of the arts and
humanities communities,
for example, by offering
opportunities for early
career researchers.
\columnbreak
\color{thegray}

\small
\flushleft

\obeylines
We have engaged both
individuals and groups to
build a vision for our strategic
initiatives and our museums
and galleries strategy, have
opened up opportunities
for the arts and humanities
in cross-Council funding
initiatives and undertaken
to represent the needs of our
communities in arenas such
as the Research Councils’
project on the Efficiency and
Effectiveness of Peer Review
Journals
initiatives and undertaken
to represent the needs of our
communities in arenas such
as the Research Councils’
project on the Efficiency and
Effectiveness of Peer Review
Journals
\end{multicols}
\end{minipage}
}
\bigskip
\bgroup


\fboxsep20pt\color{thegray!60}
\hspace*{-1.85cm}\fbox{\HHUGE Research}

\bigskip
\egroup
\raggedright
\begin{multicols}{2}
\color{black!80}

\parindent1em
\lettrine{L}{ipsum} \lipsum[1-3]
\end{multicols}

\newpage

\hspace*{-2.2cm}\begin{minipage}{\textwidth+2cm}
\columnseprule2pt
\def\columnseprulecolor{\color{spot!50!white}}
\columnsep22pt
\begin{multicols}{2}
\color{theblue}
\flushright
\LARGE
\obeylines
One of the challenges in
the area of knowledge
transfer is to identify
models of opportunity
for engagement.
\columnbreak
\color{thegray}

\large
\flushleft

\obeylines
Opportunities that build trust between
researchers and other partners; enable
an exchange of knowledge and ideas that
benefit both; and encourage novel forms
of engagement that permit academic and
non-academic partners to maximize their
contribution to the nation’s cultural, social
and economic life. 
\rule{0cm}{1cm}
\end{multicols}
\end{minipage}

\bigskip

\bgroup
\fboxsep3pt\fboxrule0pt\color{spot!50!white}
\hskip\dimexpr-\leftmargin-\hoffset\relax\fbox{\HHUGE\color{spot!50!white} Postgraduate}
\definecolor{head}{rgb}{173,216,230}
\makebox[\textwidth+\leftmargin]{\HHUGE\ZZZ \color{spot!50!white}Programmes\hfill}
\egroup

\bigskip
\parindent1em


\begin{multicols}{2}
\lettrine{P}{ost}  \lipsum
\end{multicols}
\end{document}

答案1

如果您加载该tikzmark库,您可以执行如下操作(进行一些整理):

  \bigskip
  \tikzmark{p0}

  {\fboxsep3pt\fboxrule0pt\color{spot!50!white}
  \hskip\dimexpr-\leftmargin-\hoffset\relax\fbox{\HHUGE\color{spot!50!white}\tikzmark{p3}Postgraduate\tikzmark{p1}}
  \definecolor{head}{rgb}{173,216,230}
  \makebox[\textwidth+\leftmargin]{\HHUGE\ZZZ \color{spot!50!white}\tikzmark{p4}Programmes\tikzmark{p2}\hfill}
  }

  \tikzmark{p6}
  \bigskip
  \parindent1em

  \begin{tikzpicture}[overlay, remember picture, color=spot!50!white, line width=\fboxrule]
    \draw ({pic cs:p0} -| current page.west) +(0,5pt) -| ([yshift=-10pt,xshift=5pt]{pic cs:p1}) -| ([xshift=5pt]{pic cs:p2})  |- ({pic cs:p4} |- {pic cs:p6}) -| ([yshift=-5pt, xshift=-5pt]{pic cs:p4}) |- ([yshift=-20pt]{pic cs:p3}) coordinate (p7) -- (p7 -| current page.west);
  \end{tikzpicture}

方框标题

如果需要的话,该tikzpagenodes包还可以用于将标题的右侧与右边距对齐。

答案2

使用 TeX 的规则和盒子可以吗?类似于

\raisebox{-0.5ex}{\rule{0.25pt}{1ex}}%    %% not inside the content box, hence need to add the raisebox
  \makebox[10cm]{\makebox[0cm]{%          %% in a 0pt box to superpose all 3 boxes
    blablatruc%                           %% one part of the title
  }%
  \raisebox{2.5ex}{\makebox[0pt]{\rule{3cm}{0pt}\rule{7cm}{0.25pt}}}% %% upper rule, part without "ink", part with it. Ratio should be determined automatically from the space left after the first part / before the second part
  \raisebox{-0.5ex}{\makebox[0pt]{\rule{10cm}{0.25pt}}}}%             %% lower rule
\vrule                                    %% closing rule

这个例子用类似这样的内容构成了第二部分:

      ----------+
|               |
+---------------+

相关内容