我正在尝试制作一张名片,到目前为止已经制作了以下内容(基于这):
% !TEX TS-program = xelatex
\documentclass[10pt,oneside,final]{article}
% set all margins to 0 and set business card size
\usepackage[paperwidth=3.5in,paperheight=2in,margin=0cm,noheadfoot]{geometry}
\setlength{\baselineskip}{0cm}
\setlength{\topskip}{0pt}
\usepackage{parskip} % remove paragraph indents
\usepackage{fontspec} % load external fonts
\usepackage{tikz} % drawing
\usepackage{fontawesome} % icon font
\usepackage{xcolor} % more colour options
% load and configure tikz libraries
\usetikzlibrary{matrix,calc,positioning}
% load external font
\setmainfont{Fira Sans}
\setsansfont{Fira Sans}
\setmonofont{Fira Mono}
% define some lengths for internal spacing
\newlength{\seplinewidth} \setlength{\seplinewidth}{2cm}
\newlength{\seplineheight} \setlength{\seplineheight}{1pt}
\newlength{\seplinedistance} \setlength{\seplinedistance}{0.3cm}
% colour options
\definecolor{seplinecolour}{HTML}{357f2d} % green
\definecolor{iconcolour}{HTML}{2f3142} % dark
\definecolor{textcolour}{HTML}{2f3142} % dark
\definecolor{jobtitlecolour}{HTML}{474a65} % light dark
% change global colour
\makeatletter
\newcommand{\globalcolor}[1]{%
\color{#1}\global\let\default@color\current@color
}
\makeatother
\AtBeginDocument{\globalcolor{textcolour}}
% \usepackage[colorgrid=true,gridunit=pt]{eso-pic}
\begin{document}
\thispagestyle{empty}
% \vspace*{\fill}
\begin{center}
\begin{tikzpicture}
\node (logo) {\includegraphics[width=0.95\textwidth]{isulogotest.pdf}}; %\\
\node [below= of logo.south west, anchor=north west] (name) {My First and Last Name};
\node[below=\seplinedistance of logo] (hl1) {};
\matrix [ below = of logo.south east, anchor=north east,%
column 1/.style={anchor=west,color=iconcolour},%
column 2/.style={anchor=west}] (contact){
\node{\faEnvelope}; & \node[font=\normalsize]{[email protected]}; \\
\node{\faPhone}; & \node{+1 202 202 2022}; \\
\node{\faLinkedin}; & \node{/in/myname}; \\
};
\end{tikzpicture}
\end{center}
\vspace*{\fill}
\end{document}
结果是这样的:
可以清楚的看到logo下方有过多的空白,并且左右两侧的材料没有对齐(名字和姓氏高于电子邮件---如果你想看的话可以打开网格)。
我该如何修复它?我尝试过anchor
但无济于事(可能是因为matrix
我或我的ignorance
或两者兼而有之?)。
答案1
因为您没有提供徽标 PDF 文件,所以我使用这个作为徽标的示例:
但是,无论 PDF 图形的大小如何,它都应该可以工作。我为内容的每个部分绘制了一个框。通过这种方式,您可以更好地看到它们是如何相互对齐的。我在它们之间注释了一个空节点,我不知道您为什么把它放在那里。它们不对齐的原因是因为您在左侧使用了节点,但在右侧使用了矩阵中的节点。它们具有不同的内部分隔距离。因此,您也可以将左侧内容放在带有节点的矩阵中以对齐它们。可以通过在below
命令中给出尺寸来调整徽标下的白色空间(例如below= 0.5cm of logo.south west
)。此外,我\null\vfill
在 tikz 之前和\vfill
之后添加了 tikz,以将内容垂直放在页面的中心。
% !TEX TS-program = xelatex
\documentclass[10pt,oneside,final]{article}
% set all margins to 0 and set business card size
\usepackage[paperwidth=3.5in,paperheight=2in,margin=0cm,noheadfoot]{geometry}
\setlength{\baselineskip}{0cm}
\setlength{\topskip}{0pt}
\usepackage{parskip} % remove paragraph indents
\usepackage{fontspec} % load external fonts
\usepackage{tikz} % drawing
\usepackage{fontawesome} % icon font
\usepackage{xcolor} % more colour options
% load and configure tikz libraries
\usetikzlibrary{matrix,calc,positioning}
% load external font
\setmainfont{Fira Sans}
\setsansfont{Fira Sans}
\setmonofont{Fira Mono}
% define some lengths for internal spacing
\newlength{\seplinewidth} \setlength{\seplinewidth}{2cm}
\newlength{\seplineheight} \setlength{\seplineheight}{1pt}
\newlength{\seplinedistance} \setlength{\seplinedistance}{0.3cm}
% colour options
\definecolor{seplinecolour}{HTML}{357f2d} % green
\definecolor{iconcolour}{HTML}{2f3142} % dark
\definecolor{textcolour}{HTML}{2f3142} % dark
\definecolor{jobtitlecolour}{HTML}{474a65} % light dark
% change global colour
\makeatletter
\newcommand{\globalcolor}[1]{%
\color{#1}\global\let\default@color\current@color
}
\makeatother
\AtBeginDocument{\globalcolor{textcolour}}
% \usepackage[colorgrid=true,gridunit=pt]{eso-pic}
\begin{document}
\thispagestyle{empty}
\null\vfill
\begin{center}
\begin{tikzpicture}
\node (logo) [draw] {\includegraphics[width=0.95\textwidth]{isulogotest.pdf}}; %\\
\matrix [draw,below= 0.5cm of logo.south west, anchor=north west] (name) {\node {My First and Last Name};\\};
%\node[below=\seplinedistance of logo] (hl1) {}; % I comment this empty node which I don't know why you put it here
\matrix [draw, below = 0.5cm of logo.south east, anchor=north east,%
column 1/.style={anchor=west,color=iconcolour},%
column 2/.style={anchor=west}] (contact)
{
\node{\faEnvelope}; & \node[font=\normalsize]{[email protected]}; \\
\node{\faPhone}; & \node{+1 202 202 2022}; \\
\node{\faLinkedin}; & \node{/in/myname}; \\
};
\end{tikzpicture}
\end{center}
\vfill
\end{document}
输出: