这是我使用以下代码得到的结果:
\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\usepackage{graphicx}
\usepackage{calligra}
\usetikzlibrary{positioning}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{xcolor}
\usepackage[colorlinks=true,urlcolor=blue]{hyperref}
\begin{document}
\begin{tikzpicture}
\node (UAF) at (0, 0) {\Huge \sc University of Agriculture, Faisalabad};
\node [below of = UAF] (Dept) {\Huge {\calligra Department of Mathematics \& Statistics}};
\node [below left of = Dept] (Phone1) {\Large \phone ~ +41-9200161-70/3317};
\node [below left of = Phone1] (Phone2) {\Large \phone ~ +41-9200457};
\node [below left of = Phone2] (Email1) {\Large \Email ~ \href{mailto:[email protected]}{[email protected]}};
\node [below left of = Email1] (Email2) {\Large \Email ~ \href{mailto:[email protected]}{[email protected]}};
\node [right of = Phone2] (MS) {\Large M\&S No:\hrulefill{}};
\node [right of = Email2] (Date) {\Large Dated:\hrulefill{}};
\node[inner sep=0pt, left = of Dept.west] (LogoUAF) {\includegraphics[width=0.25\textwidth]{LogoUAF.png}};
\end{tikzpicture}
\end{document}
我对节点放置有几个疑问。
- 我希望电话号码和电子邮件左对齐,并且应该从部门 D 的正下方开始。
- M&S No 和 Dated 应该右对齐并以 \hrulefill{} 输出结尾。
- 徽标应左对齐,并应覆盖所有六行。
任何帮助都将不胜感激。谢谢
答案1
使用一些tikz库使我们的生活更轻松:fit
、、以及已经在使用的。calc
shapes.multipart
positioning
通过使用fit
库,我们可以将所有元素捆绑到一个Box
节点中,然后使用calc
库来测量此节点的大小,然后将该值提供给\includegraphics
\documentclass[margin=5mm]{standalone}
\usepackage{tikz,graphicx}
\usetikzlibrary{positioning, shapes.multipart, fit, calc}
\usepackage{marvosym,wasysym,calligra}
\usepackage[colorlinks=true,urlcolor=blue]{hyperref}
\begin{document}
\begin{tikzpicture}[caligraphic/.style={font=\Huge\calligra}, every node/.style={font=\Large}]
\node[font=\Huge\scshape] (UAF) at (0, 0) {University of Agriculture, Faisalabad};
\node [below =3mm of UAF, caligraphic] (Dept) {Department of Mathematics \& Statistics};
\node [below right= 5mm and 3mm of Dept.text,
rectangle split, rectangle split parts=4,
rectangle split part align={left}] (Info)
{\phone ~ +41-9200161-70/3317
\nodepart{two}\phone ~ +41-9200457
\nodepart{three}\Email ~ \href{mailto:[email protected]}{[email protected]}
\nodepart{four}\Email ~ \href{mailto:[email protected]}{[email protected]}};
\node [right = of Info.two east] (MS) {M\&S No:};
\node [right = of Info.four east] (Date) {Dated:};
\node[inner sep=0pt, fit=(UAF) (Info) (MS) (Date) (Dept)] (Box){};
\draw (MS.south east) -- (MS.south east-|Box.south east);
\draw (Date.south east) -- (Date.south east-|Box.south east);
\path let \p1=($(Box.north)-(Box.south)$) in node[inner sep=0pt, left = 0mm of Box] (LogoUAF) {\includegraphics[height=\y1]{LogoUAF.png}};
\end{tikzpicture}
\end{document}
答案2
没有 TikZ,只是为了好玩。
\documentclass[border=5]{standalone}
\usepackage{graphicx}
\usepackage{calligra}
\usepackage{marvosym,wasysym}
\usepackage[colorlinks=true,urlcolor=blue]{hyperref}
\newsavebox{\logobox}
\newsavebox{\databox}
\newlength{\institutionwidth}
\newlength{\departmentwidth}
\newlength{\departmentindent}
\newcommand{\institution}{University of Agriculture, Faisalabad}
\newcommand{\department}{Department of Mathematics \& Statistics}
\begin{document}
\sbox{\logobox}{\includegraphics[width=2.5cm]{IuTEV.png}}%
\settowidth{\institutionwidth}{\Large\scshape\institution}%
\settowidth{\departmentwidth}{\large\calligra\department}%
\setlength{\departmentindent}{\dimexpr(\institutionwidth-\departmentwidth)/2}%
\addtolength{\departmentwidth}{\departmentindent}%
\sbox{\databox}{%
\small
\begin{tabular}[b]{@{}l@{}}
\phone\ +41-9200161-70/3317 \\
\phone\ +41-9200457 \\
\Email\ \href{mailto:[email protected]}{[email protected]} \\
\Email\ \href{mailto:[email protected]}{[email protected]}
\end{tabular}%
}%
\usebox{\logobox}\hspace{2mm}% <--- adjust the spacing
\begin{minipage}[b][\ht\logobox][s]{\institutionwidth}
{\Large\scshape\institution}\par
\vspace{\stretch{1}}%
\hspace*{\departmentindent}{\large\calligra\department}\par
\vspace{\stretch{3}}%
\hspace*{\departmentindent}%
\usebox{\databox}\hspace{2em}%
\begin{minipage}[b]{\dimexpr\departmentwidth-2em-\wd\databox}
\makebox[\linewidth]{M\&S No: \hrulefill}\par
\medskip
\makebox[\linewidth]{Dated: \hrulefill}
\end{minipage}
\end{minipage}
\end{document}
如果你需要规则,它们如下:
\documentclass[border=5]{standalone}
\usepackage{graphicx}
\usepackage{calligra}
\usepackage{marvosym,wasysym}
\usepackage[colorlinks=true,urlcolor=blue]{hyperref}
\newsavebox{\logobox}
\newsavebox{\databox}
\newlength{\institutionwidth}
\newlength{\departmentwidth}
\newlength{\departmentindent}
\newcommand{\institution}{University of Agriculture, Faisalabad}
\newcommand{\department}{Department of Mathematics \& Statistics}
\begin{document}
\sbox{\logobox}{\includegraphics[width=2.5cm]{IuTEV.png}}%
\settowidth{\institutionwidth}{\Large\scshape\institution}%
\settowidth{\departmentwidth}{\large\calligra\department}%
\setlength{\departmentindent}{\dimexpr(\institutionwidth-\departmentwidth)/2}%
\addtolength{\departmentwidth}{\departmentindent}%
\sbox{\databox}{%
\small
\begin{tabular}[b]{@{}l@{}}
\phone\ +41-9200161-70/3317 \\
\phone\ +41-9200457 \\
\Email\ \href{mailto:[email protected]}{[email protected]} \\
\Email\ \href{mailto:[email protected]}{[email protected]}
\end{tabular}%
}%
\begin{minipage}{\dimexpr\institutionwidth+\wd\logobox+2mm}
\hrule\vspace{3pt}
\usebox{\logobox}\hspace{2mm}% <--- adjust the spacing
\begin{minipage}[b][\ht\logobox][s]{\institutionwidth}
{\Large\scshape\institution}\par
\vspace{\stretch{1}}%
\hspace*{\departmentindent}{\large\calligra\department}\par
\vspace{\stretch{3}}%
\hspace*{\departmentindent}%
\usebox{\databox}\hspace{2em}%
\begin{minipage}[b]{\dimexpr\departmentwidth-2em-\wd\databox}
\makebox[\linewidth]{M\&S No: \hrulefill}\par
\medskip
\makebox[\linewidth]{Dated: \hrulefill}
\end{minipage}
\end{minipage}
\vspace{3pt}\hrule
\end{minipage}
\end{document}
答案3
这是一个不带 的解决方案tikz
,专为类中的文档宽度而设计article
。它可以轻松调整为另一个\textwidth
。
\documentclass{article}
\usepackage{graphicx}
\usepackage{calligra}
\usepackage{marvosym,wasysym}
\usepackage{tabularx}
\usepackage[colorlinks=true,urlcolor=blue]{hyperref}
\newcommand\fillarea{\makebox[6em]{\hrulefill}}
\let\sizeA\Large
\let\sizeB\footnotesize
\begin{document}
\newsavebox\UAF
\savebox\UAF{\scalebox{0.97}{\sizeA\scshape University of Agriculture, Faisalabad}}%
\noindent
\includegraphics[width=2.3cm]{LogoUAF.png}%
\hspace{-0.2em}%
\begin{tabular}[b]{@{}c@{}}
\usebox\UAF\\[0.7ex]
\begin{tabularx}{\wd\UAF}[b]{@{}X@{}l@{}>{\raggedleft\arraybackslash}X@{}}
&\sizeA\calligra Department of Mathematics \& Statistics&\\[1.4ex]
&\sizeB\phone ~ +41-9200161-70/3317 &\\
&\sizeB\phone ~ +41-9200457 &\makebox[0em][r]{\sizeB M\&S No: \fillarea}\\
&\sizeB\Email ~ \href{mailto:[email protected]}{[email protected]}&\\
&\sizeB\Email ~ \href{mailto:[email protected]}{[email protected]}&\makebox[0em][r]{\sizeB Dated: \fillarea}
\end{tabularx}
\end{tabular}
\end{document}
答案4
使用以下代码:
\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\usepackage{graphicx}
\usepackage{calligra}
\usetikzlibrary{positioning}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{xcolor}
\usepackage[colorlinks=true,urlcolor=blue]{hyperref}
\begin{document}
\begin{tikzpicture}
\node (UAF) at (0, 0) {\Huge \sc University of Agriculture, Faisalabad};
\node [below of = UAF] (Dept) {\Huge {\calligra Department of Mathematics \& Statistics}};
\node [below = of Dept.west, anchor=west, yshift=-0.07cm] (Phone1) {\Large \phone ~ +41-9200161-70/3317};
\node [below = of Phone1.west, anchor=west, yshift=0.50cm] (Phone2) {\Large \phone ~ +41-9200457};
\node [below = of Phone2.west, anchor=west, yshift=0.50cm] (Email1) {\Large \Email ~ \href{mailto:[email protected]}{[email protected]}};
\node [below = of Email1.west, anchor=west, yshift=0.50cm] (Email2) {\Large \Email ~ \href{mailto:[email protected]}{[email protected]}};
\node [right = of Phone2.east, anchor=west, xshift=3.50cm] (MS) {\Large M\&S No:\hrulefill{}};
\node [below = of MS.west, anchor=west] (Date) {\Large Dated:\hrulefill{}};
\node[inner sep=0pt, left = of Dept.west, xshift=-0.45cm, yshift=-0.60cm] (LogoUAF) {\includegraphics[width=0.27\textwidth]{LogoUAF.png}};
\end{tikzpicture}
\end{document}