这是《标题页示例》一书中的第一个代码,https://ctan.org/pkg/titlepages但我遇到了很多错误。
\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{url}
\usepackage[svgnames]{xcolor}
\ifpdf
\usepackage{pdfcolmk}
\fi
%% check if using xelatex rather than pdflatex
\ifxetex
\usepackage{fontspec}
\fi
\usepackage{graphicx}
%%\usepackage{hyperref}
%% drawing package
\usepackage{tikz}
%% for dingbats
\usepackage{pifont}
\providecommand{\HUGE}{\Huge}% if not using memoir
\newlength{\drop}% for my convenience
%% specify the Webomints family
\newcommand*{\wb}[1]{\fontsize{#1}{#2}\usefont{U}{webo}{xl}{n}}
%% select a (FontSite) font by its font family ID
\newcommand*{\FSfont}[1]{\fontencoding{T1}\fontfamily{#1}\selectfont}
%% if you don’t have the FontSite fonts either \renewcommand*{\FSfont}[1]{}
%% or use your own choice of family.
%% select a (TeX Font) font by its font family ID
\newcommand*{\TXfont}[1]{\fontencoding{T1}\fontfamily{#1}\selectfont}
%% Generic publisher’s logo
\newcommand*{\plogo}{\fbox{$\mathcal{PL}$}}
%% Some shades
\defincolor{Dark}{gray}{0.2}
\defincolor{MedDark}{gray}{0.4}
\defincolor{Medium}{gray}{0.6}
\defincolor{Light}{gray}{0.8}
%%%% Additional font series macros
\makeatletter
%%%% light series
%% e.g., kernel doc, section s: line 12 or thereabouts
\DeclareRobustCommand\ltseries
{\not@math@alphabet\ltseries\relax
\fontseries\ltdefault\selectfont}
%% e.g., kernel doc, section t: line 32 or thereabouts
\newcommand{\ltdefault}{l}
%% e.g., kernel doc, section v: line 19 or thereabouts
\DeclareTextFontCommand{\textlt}{\ltseries}
% heavy(bold) series
\DeclareRobustCommand\hbseries
{\not@math@alphabet\hbseries\relax
\fontseries\hbdefault\selectfont}
\newcommand{\hbdefault}{hb}
\DeclareTextFontCommand{\texthb}{\hbseries}
\makeatother
\newcommand*{\titleJT}{\begingroup% Jan Tschichold: typographer
\FSfont{5gm} % FontSite Garamond
\drop = 0.08\textheight
\vspace*{\drop}
\hspace*{0.3\textwidth}
{\Large The Author}\\[2\drop]
\hspace*{0.3\textwidth}{\Huge\itshape The Big Book of}\par
{\raggedleft\Huge\itshape Conundrums\par}
\vfill
\hspace*{0.3\textwidth}{\Large \plogo}\\[0.5\baselineskip]
\hspace*{0.3\textwidth}{\Large The Publisher}
\vspace*{\drop}
\endgroup}
\begin{document}
\pagestyle{empty}
\titleX
\clearpage
\end{document}
答案1
感谢 DavidCarlisle 和 Bernard。
\documentclass{book}
\usepackage{iftex}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{url}
\usepackage[svgnames]{xcolor}
\ifpdf
\usepackage{pdfcolmk}
\fi
%% check if using xelatex rather than pdflatex
\ifxetex
\usepackage{fontspec}
\fi
\usepackage{graphicx}
%%\usepackage{hyperref}
%% drawing package
\usepackage{tikz}
%% for dingbats
\usepackage{pifont}
\providecommand{\HUGE}{\Huge}% if not using memoir
\newlength{\drop}% for my convenience
%% specify the Webomints family
\newcommand*{\wb}[2]{\fontsize{#1}{#2}\usefont{U}{webo}{xl}{n}}
%% select a (FontSite) font by its font family ID
\newcommand*{\FSfont}[1]{\fontencoding{T1}\fontfamily{#1}\selectfont}
%% if you don’t have the FontSite fonts either \renewcommand*{\FSfont}[1]{}
%% or use your own choice of family.
%% select a (TeX Font) font by its font family ID
\newcommand*{\TXfont}[1]{\fontencoding{T1}\fontfamily{#1}\selectfont}
%% Generic publisher’s logo
\newcommand*{\plogo}{\fbox{$\mathcal{PL}$}}
%% Some shades
\definecolor{Dark}{gray}{0.2}
\definecolor{MedDark}{gray}{0.4}
\definecolor{Medium}{gray}{0.6}
\definecolor{Light}{gray}{0.8}
%%%% Additional font series macros
\makeatletter
%%%% light series
%% e.g., kernel doc, section s: line 12 or thereabouts
\DeclareRobustCommand\ltseries
{\not@math@alphabet\ltseries\relax
\fontseries\ltdefault\selectfont}
%% e.g., kernel doc, section t: line 32 or thereabouts
\newcommand{\ltdefault}{l}
%% e.g., kernel doc, section v: line 19 or thereabouts
\DeclareTextFontCommand{\textlt}{\ltseries}
% heavy(bold) series
\DeclareRobustCommand\hbseries
{\not@math@alphabet\hbseries\relax
\fontseries\hbdefault\selectfont}
\newcommand{\hbdefault}{hb}
\DeclareTextFontCommand{\texthb}{\hbseries}
\makeatother
\newcommand*{\titleJT}{\begingroup% Jan Tschichold: typographer
\FSfont{5gm} % FontSite Garamond
\drop = 0.08\textheight
\vspace*{\drop}
\hspace*{0.3\textwidth}
{\Large The Author}\\[2\drop]
\hspace*{0.3\textwidth}{\Huge\itshape The Big Book of}\par
{\raggedleft\Huge\itshape Conundrums\par}
\vfill
\hspace*{0.3\textwidth}{\Large \plogo}\\[0.5\baselineskip]
\hspace*{0.3\textwidth}{\Large The Publisher}
\vspace*{\drop}
\endgroup}
\begin{document}
\pagestyle{empty}
\title{\titleJT}
\maketitle
\clearpage
\end{document}