整个过程使用 TikZ

整个过程使用 TikZ

我想在我的标题页中重现以下标题,代码如下(此图是使用页面(来自 Apple):

在此处输入图片描述

这是我要使用的标题页代码:

\documentclass[letterpaper]{book}
\usepackage[T1]{fontenc}
\usepackage{microtype,lmodern}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage{anysize}
\marginsize{1.5in}{1in}{0.5in}{0.5in}
\usepackage{xcolor}
\definecolor{backgroundcolor}{RGB}{160,180,200}
\usepackage{graphicx}
\usepackage{here}
\usepackage{afterpage}
\usepackage{tikz}
\usetikzlibrary{calc}

\newcommand*{\maintitle}{\begingroup

\pagecolor{backgroundcolor}

\centering

\vspace*{5\baselineskip}

{\Huge\scshape\textcolor{black}{\textbf{Matière \& Espace-Temps}}}

\vspace*{2\baselineskip}

{\large La théorie classique des champs relativistes}

\vfill

{\Large\scshape Mickey Mouse}

\vfill

    \newlength{\titlelength}
    \settowidth{\titlelength}{\Huge\scshape\textbf{Matière \& Espace-Temps}}

    \begin{figure}[H]
        \centering
        \fbox{\includegraphics[width=\titlelength]{example-image}}
    \end{figure}

\vfill

{\large\scshape Version number}

\par

\endgroup}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\begin{titlepage}

% FRAME AROUND PAGE :
    \begin{tikzpicture}[remember picture, overlay]
        \draw[line width = 1in,color = white] ($(current page.north west) + (0.25in,0.25in)$) rectangle ($(current page.south east) + (0.25in,-0.25in)$);
        \draw[line width = 0.25pt,color = black] ($(current page.north west) + (0.75in,-0.25in)$) rectangle ($(current page.south east) + (-0.25in,0.25in)$);
        \draw[line width = 1pt,color = white] ($(current page.north west) + (1in,-0.5in)$) rectangle ($(current page.south east) + (-0.5in,0.5in)$);
    \end{tikzpicture}

    \maintitle
\end{titlepage}

\end{document}

预览此代码的作用:

在此处输入图片描述

我不知道如何编写上面显示的标题,尤其是放置在主标题下方的大“&”及其透明效果。我不知道如何加载和使用另一种字体仅用于主标题,而不更改现代其余部分使用字体。有什么建议如何在 LaTeX 中实现这一点?

答案1

整个过程使用 TikZ

有一位评论者问我为什么不用 TikZ 制作整个标题页,我只能尝试一下。结果如下。我确信,居中左对齐定位可以优化。如果有人知道如何优化,请给我留言,我会进行编辑。

代码现在更短更清晰了:

\documentclass{article}
\usepackage{librebaskerville}
\usepackage{tikz}
\usetikzlibrary{positioning,fit,shapes.geometric,calc,backgrounds}

\tikzstyle{titlepage}=[text width=\paperwidth, text centered]

\definecolor{titlepage-background}{RGB}{160, 180, 200}
\definecolor{titlepage-title}{RGB}{26, 51, 74}
\definecolor{titlepage-ampersand}{RGB}{188, 205, 219}
\definecolor{titlepage-subtitle}{RGB}{97, 125, 150}

\begin{document}
    \begin{titlepage}
        
        \begin{tikzpicture}[remember picture,overlay]
            \fill[titlepage-background] (current page.south east) rectangle (current page.north west);
            
            \draw[line width = 1in,color = white] ($(current page.north west) + (0.25in,0.25in)$) rectangle ($(current page.south east) + (0.25in,-0.25in)$);
            \draw[line width = 0.25pt,color = black] ($(current page.north west) + (0.75in,-0.25in)$) rectangle ($(current page.south east) + (-0.25in,0.25in)$);
            \draw[line width = 1pt,color = white] ($(current page.north west) + (1in,-0.5in)$) rectangle ($(current page.south east) + (-0.5in,0.5in)$);
            
            \node [opacity=1,titlepage-ampersand,anchor=west] at (7.25,-3.5) {\scalebox{10}{\&}};
            \node [titlepage-title,anchor=west,xshift=.725in] at (0,-3) {\scalebox{4}{\textbf{Matière}}};
            \node [titlepage-title,anchor=west,xshift=.725in] at (0,-4.5) {\scalebox{3}{\textbf{Espace-Temps}}};
            \node [titlepage-subtitle,anchor=west,xshift=.725in] (theorie) at (0,-6) {\scalebox{1.1}{La théorie classique des champs relativistes}};
            \node [titlepage, titlepage-subtitle] at ([xshift=.25in]current page.center) {Mickey Mouse};
            
            \node[xshift=.25in, inner sep=0pt] (image) at ([yshift=7cm]current page.south) {\includegraphics[width=8.5cm]{example-image}};
            \node[align=left,black,anchor=north] at ([yshift=-1.5cm]image.south) {Version number};
        \end{tikzpicture}

    \end{titlepage}
\end{document}

输出也相当不错:

整个过程使用 TikZ

更老更混乱的解决方案

好吧,代码确实不好看。但这是个开始。

我个人认为我所做的违背了使用 LaTeX 的目的,因为一旦你改变字体系列或字体大小,你就必须手动摆弄大小、尺寸和间距——太可怕了!

我以你只有一个标题页的事实来证明我的行为,所以这种我称之为代码的可恶的事情不会经常发生;-)

我邀请所有专家参与并进行编辑

\documentclass[letterpaper]{book}

\usepackage{librebaskerville}
\usepackage[T1]{fontenc}

\usepackage{microtype}
\usepackage[french]{babel}
\usepackage{anysize}
\marginsize{1.5in}{1in}{0.5in}{0.5in}
\usepackage[x11names]{xcolor}
\definecolor{backgroundcolor}{RGB}{160,180,200}
\definecolor{myamper}{RGB}{188, 205, 219}
\definecolor{subtitle}{RGB}{97, 125, 150}
\usepackage{graphicx}
\usepackage{here}
\usepackage{afterpage}
\usepackage{tikz}
\usetikzlibrary{calc}


\newcommand*{\maintitle}{\begingroup

\pagecolor{backgroundcolor}

\centering

\vspace*{5\baselineskip}
\begin{minipage}[t][5cm][b]{.5\textwidth}
{\fontsize{35}{30}\selectfont\textbf{Matière}}

{\raisebox{-2.25em}[0pt][0pt]{\fontsize{95}{90}\selectfont\bfseries\noindent\hspace{1.35em}\textcolor{myamper} \&}}

{\fontsize{25}{25}\selectfont\textbf{Espace-Temps}}

\vspace*{\baselineskip}

\textcolor{subtitle}{La théorie classique des champs relativistes}
\end{minipage}
\vfill

{\Large\ Mickey Mouse}

\vfill

    \newlength{\titlelength}
    \settowidth{\titlelength}{\Huge\textbf{Matière \& Espace-Temps}}

    \begin{figure}[H]
        \centering
        \fbox{\includegraphics[width=\titlelength]{example-image}}
    \end{figure}

\vfill

{\large Version number}

\par

\endgroup}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\begin{titlepage}

% FRAME AROUND PAGE :
    \begin{tikzpicture}[remember picture, overlay]
        \draw[line width = 1in,color = white] ($(current page.north west) + (0.25in,0.25in)$) rectangle ($(current page.south east) + (0.25in,-0.25in)$);
        \draw[line width = 0.25pt,color = black] ($(current page.north west) + (0.75in,-0.25in)$) rectangle ($(current page.south east) + (-0.25in,0.25in)$);
        \draw[line width = 1pt,color = white] ($(current page.north west) + (1in,-0.5in)$) rectangle ($(current page.south east) + (-0.5in,0.5in)$);
    \end{tikzpicture}

    \maintitle
\end{titlepage}

\end{document}

封面

相关内容