这是我的代码:
\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage[10pt]{moresize}
\usepackage{graphicx}
\usepackage[a6paper]{geometry}
\usepackage{fancyhdr}
\usepackage{hyperref}
\usepackage{wrapfig}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{enumitem}
\usepackage{soul}
\usepackage[T1]{fontenc}
\usepackage{lipsum}
\usepackage{fontspec}
\definecolor{blu1000}{RGB}{15, 57, 101}
\definecolor{marrone1000}{HTML}{a4895e}
\definecolor{marronescuro1000}{HTML}{483a26}
\begin{document}
\vspace*{-5\baselineskip}
\null\hfill {\color{marrone1000} \tiny Certificato d'iscrizione} \\ [\baselineskip]
\vspace*{2\baselineskip}
\centering
\includegraphics[height=2.5cm]{img-1} \\ [\baselineskip]
\color{marrone1000}{
\noindent\framebox[3cm][c]{\color{blu1000}\textbf{N. 1001-P}}
\noindent\framebox[3cm][c]{\color{blu1000}\textbf{1001-P-YY-YY}} \\ [.15\baselineskip]
}
\raggedright \hspace{2.5em}\tiny \color{marrone1000} Identification Number \hspace{5.7em}\tiny Certificate Number \\ [\baselineskip]
\centering
\color{blu1000}{
\noindent\framebox[6cm][c]{\normalsize\color{blu1000}\textbf{Class Winner}} \\ [.15\baselineskip]
\raggedright \hspace{5em}\tiny Category \\ [3\baselineskip]
}
\vspace{5\baselineskip}
\begin{wrapfigure}{l}{.4\textwidth}
\vspace{-24pt}
\hspace{-14em}
\centering
\includegraphics[width=0.40\textwidth]{default_qrcode}
% \vspace{-20pt}
\end{wrapfigure}
\textcolor{blu1000}{CERTIFICATE} \\ [2\baselineskip]
\color{marrone1000}{
\noindent \rule{3cm}{0.4pt} \\ [0.15\baselineskip] \hspace{-6em}{Date of Issue \\ [2\baselineskip]}
\noindent \rule{3cm}{0.4pt} \\ [0.15\baselineskip] \hspace{-6em}{Expiry Date\\ [2\baselineskip]}
}
\clearpage
\end{document}
我正在使用 XeLatex,我想将文本左对齐,如下所示1
答案1
看看以下解决方案是否可以接受:
\documentclass{article}
\usepackage[showframe, % <--- in real document delete option "showframe"
a6paper]{geometry}
\usepackage{fontspec}
\usepackage{xcolor}
\definecolor{marrone1000}{HTML}{a4895e}
\usepackage[10pt]{moresize}
\usepackage[demo, % <--- in real document delete option "demo"
export]{adjustbox} % <--- it load the graphicx package
\begin{document}
\begin{center}
\begin{minipage}[t]{0.3\linewidth}\centering
\includegraphics[height=2.5cm, width=\linewidth,valign=t]{img-1}
\end{minipage}
\quad
\begin{minipage}[t]{0.3\linewidth}\raggedright
CERTIFICATE \\[1.5\baselineskip]
\tiny
\color{marrone1000}
\rule[-0.5ex]{\linewidth}{0.2pt}
Date of issue: \\[1.5\baselineskip]
\rule[-0.5ex]{\linewidth}{0.2pt}
Expire date
\end{minipage}
\end{center}
\end{document}
如您所见,我将您的文档示例简化为 mwe(最小工作示例),其产生的结果与您的问题中的第一个图像类似。
编辑:首先,为了对齐图像,minipage
需要将其基线从中间移到顶部。这是通过使用adjustbox
with 选项来完成的export
。此包也加载了该graphicx
包。
(图片和文字周围的线条显示页面布局)