假设我有一个书名,想用 Latex 排版:
__________________
| |
| ____________ |
| | | |
| | | |
| | | |
| | | |
| | IMAGE | |
| | | |
| | | |
| | | |
| | | |
| ____________ |
| |
| |
| Title |
|__________________|
该图像是有机主题的透明 PNG,因此您实际上看不到矩形。图像只是缩小了(比如说从 1500x3000px 缩小到 8x10 的书籍封面)。标题位于右侧图像下方。我基本上有这个 MWE:
\documentclass[twoside,a4paper,4mm,5mm]{book}
\usepackage[dvipsnames]{xcolor}
\usepackage{fontspec}
\usepackage{titlesec}
\usepackage{fullpage}
\usepackage{geometry}
\usepackage{sectsty}
\usepackage{graphics}
\usepackage{wallpaper}
\usepackage[hidelinks]{hyperref}
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=black
}
\renewcommand{\contentsname}{Contents}
\setmainfont[Ligatures=TeXReset]{MyMonospaceFont}
\newlength{\characterwidth}
\setmonofont{black}[
Scale=MatchLowercase
]
\settowidth{\characterwidth}{\normalfont x}
\geometry{
left=24mm,
right=24mm,
top=24mm,
bottom=40mm,
footskip=24mm
}
\AtBeginDocument{\raggedright}
\frenchspacing
\makeatletter
\renewcommand\tableofcontents{%
\@starttoc{toc}%
}
\makeatother
\titleformat{\chapter}[display]
{\filleft\Huge\bfseries\null\vfill\fontsize{8mm}{12mm}\selectfont}
{\thechapter}
{0pc}
{}
[\newpage]
\definecolor{G1}{HTML}{777777}
\newcommand{\ga}[1]{\textcolor{G1}{#1}}
\usepackage{fancyhdr}
\chapterfont{\fontsize{8mm}{12mm}\selectfont}
\sectionfont{\fontsize{4mm}{6mm}\selectfont}
\paragraphfont{\fontsize{4mm}{6mm}\selectfont}
\renewcommand{\c}[1]{\chapter*{#1}\addcontentsline{toc}{chapter}{#1}}
\renewcommand{\l}[1]{\input{#1}}
\newcommand{\s}[1]{\section*{#1}}
\newcommand{\p}[1]{\paragraph*{#1}}
\renewcommand{\t}[2]{
\begin{titlepage}
\null\vfill
\begin{flushright}
\fontsize{16mm}{24mm}\selectfont #1
\fontsize{8mm}{12mm}\selectfont #2
\end{flushright}
\thispagestyle{empty}
\end{titlepage}
}
\renewcommand{\o}{\tableofcontents}
\renewcommand{\i}[1]{\includegraphics{#1}}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\fancyhead[RE]{\leftmark}
\fancyhead[LO]{\rightmark}
\fancyfoot[R]{\fontsize{4mm}{6mm}\selectfont \thepage}
\fancypagestyle{plain}{
\renewcommand\headrulewidth{0pt}
\fancyhf{}
\fancyfoot[R]{}
}
\fancypagestyle{empty}{
\chead{}
\lfoot{}
\cfoot{}
\rfoot{}
}
\begin{document}
% first page is cover of book.
\begin{center}
\i{img.png}
\end{center}
\begin{titlepage}
\null\vfill
\begin{flushright}
\fontsize{100mm}{120mm}\selectfont #1
\thispagestyle{empty}
\end{titlepage}
% chapters of book
% back cover of book
如何实现这一点?理想情况下,可以在封面上做到这一点和还有“封底”页 :)
答案1
使用文本位置是可能的。您可以将图像放在一个textblock
环境中,将标题放在另一个环境中,然后更改坐标以适合您。
没有必要为每个元素定义一个宏,但是如果您有许多项目,则可以轻松更改布局。
\documentclass[demo]{article}
\usepackage[absolute]{textpos}
\usepackage{graphicx}
\setlength{\TPHorizModule}{1mm}
\setlength{\TPVertModule}{1mm}
\DeclareRobustCommand*{\image}{%
\begin{textblock}{200}(20,20)
\includegraphics*[height=200mm, width=160mm]{C:/temp/lisa-simpson.png}%
\end{textblock}%
}
\DeclareRobustCommand*{\mytitle}{%
\begin{textblock}{150}(130,230)
\Huge\bfseries This is my title%
\end{textblock}%
}
\begin{document}
\image
\mytitle
\end{document}