我想将 对齐pspicture
到页面的左上角。目前,当我想将这两个对齐在一起时,它略低于标题文本。
电子邮件/网站信息的表格稍微缩进,所以我也想删除该缩进。
我还希望“Lorem Ipsum Dolor”部分没有缩进,但我知道如何解决这个问题。
是的,我的.tex
文件如下所示:
% LaTeX CV
\documentclass[final,a4paper,notitlepage,10pt]{report}
%%% Packages %%%
\usepackage[utf8]{inputenc} % inputenc for encoding to utf8
\usepackage{auto-pst-pdf} % auto-pst-pdf converts pst to pdf
\usepackage{pst-barcode} % pst-barcode try implement QR code
\usepackage{multicol} % multicol used for multiple columns
\usepackage[paper=a4paper,left=0.7cm,right=0.7cm,top=0.7cm,bottom=0.7cm,noheadfoot]{geometry} % geometry for margins
\usepackage[hidelinks,breaklinks]{hyperref} % hyperref for linking references for pdf
\usepackage{wrapfig} % wrapfig to wrap text around figures
\usepackage{mdwlist} % mdwlist for compact enumeration/list items
\usepackage[compact]{titlesec} % titlesec for title section layout
\usepackage{mdwlist} % mdwlist for compact enumeration/list items
% Rule settings
\hyphenpenalty=5000
\tolerance=1000
% for mailto command
\newcommand{\mailto}[1]{\href{mailto:#1}{#1}}
% Name and contact information
\newcommand{\name}{FirstName LastName}
\newcommand{\addr}{123 Fake Street, London, XX00 0XX, England}
\newcommand{\phone}{+44 123 456 6789}
\newcommand{\email}{\mailto{[email protected]}}
\newcommand{\website}{\href{http://google.com}{http://google.com}}
% change itemize to be compact
\makecompactlist{compactitemize}{itemize}
% tweak title spacing
\titlespacing{\section}{0pt}{*2}{*0}
\titlespacing{\subsection}{0pt}{*2}{*0}
\titlespacing{\subsubsection}{0pt}{*2}{*0}
% disables chapter, section and subsection numbering
\setcounter{secnumdepth}{-1}
% set paragraph indent to 0
\setlength\parindent{0pt}
% begin actual CV
\begin{document}
\thispagestyle{empty} % this page does not have a header
\begin{wrapfigure}[5]{l}{1.2in}
\begin{pspicture}(1in,1in)
% The MECARD format is used to exchange contact information.
\psbarcode{MECARD:N:LastName,FirstName;EMAIL:[email protected];URL:http://google.com;}}{}{qrcode}
\end{pspicture}
\end{wrapfigure}
\noindent \textbf{\LARGE \name }\\
\textit{
\begin{tabular}{l l}\\
Email: \email\ & Address: \addr \\
Web: \website\ & Mobile: \phone \\
\end{tabular}
}\\
Objective: Lorem ipsum dolor sit amet, consectetur adipisicing elit.\\
\section{Lorem Ipsum Dolor}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
\end{document}
我怎样才能将顶部pspicture
与文本对齐?我应该使用minipage
环境吗?我应该为表格使用不同的表格包吗?
生成的 PDF 文档类似于:
答案1
首先对您的示例进行一点小评论。对于 MWE 来说,它太长了,并且无法编译,因为它存在一些问题,例如加载包时关闭方括号geometry
。
我制作了一个较小的文件来说明对齐两个块的技术。您可以使用 minipages 来封闭块并获得更多控制权。我们还将它们封闭起来,以便fbox
能够可视化所有内容。
对齐小页面的方法有很多种,但在这种情况下最简单的方法是插入一条小规则并将文本向上推。(文本块左侧的橙色规则)。
一旦所有内容都对齐,就可以将规则宽度设为零并设置\fboxrule0pt
。最终完成的标题应如下所示:
这是 MWE:
\documentclass[final,a4paper,notitlepage,10pt]{report}
\usepackage[utf8]{inputenc} % inputenc for encoding to utf8
\usepackage{auto-pst-pdf} % auto-pst-pdf converts pst to pdf
\usepackage{pst-barcode} % pst-barcode try implement QR code
\usepackage[paper=a4paper,left=0.7cm,right=0.7cm,top=0.7cm,bottom=0.7cm,noheadfoot] {geometry} % geometry for margins
% for mailto command
\newcommand{\mailto}[1]{\href{mailto:#1}{#1}}
% Name and contact information
\newcommand{\name}{FirstName LastName}
\newcommand{\addr}{123 Fake Street, London, XX00 0XX, England}
\newcommand{\phone}{ +44 123 456 6789 }
\newcommand{\email}{\mailto{[email protected]}}
\newcommand{\website}{\href{http://google.com}{http://google.com}}
\setlength\parindent{0pt}
\fboxsep0pt
\fboxrule0pt
\usepackage{hyperref}
\begin{document}
\thispagestyle{empty} % this page does not have a header
\fbox{\begin{minipage}[t]{\textwidth}
\fbox{\begin{minipage}{1.378in}
\begin{pspicture}(1.378in, 1.5in)
\psbarcode[]{2}{height=1.378 width=1.378}{qrcode}
{\color{white}2}
\end{pspicture}
\end{minipage}}\hspace{0.3cm}% adjust for horizontal spacing
\fbox{\begin{minipage}{0.7\textwidth}
\textbf{\LARGE \name }\\
\textit{%
\begin{tabular}{l l}\\
Email: \email\ & Address: \addr \\
Web: \website\ & Mobile: \phone \\
\end{tabular}
}
{\color{orange}\rule{3pt}{39pt}}
\end{minipage}}
\end{minipage}}
\end{document}