![恢复 - 将节点锚定到左上角,并将其他节点置于其下方](https://linux22.com/image/407680/%E6%81%A2%E5%A4%8D%20-%20%E5%B0%86%E8%8A%82%E7%82%B9%E9%94%9A%E5%AE%9A%E5%88%B0%E5%B7%A6%E4%B8%8A%E8%A7%92%EF%BC%8C%E5%B9%B6%E5%B0%86%E5%85%B6%E4%BB%96%E8%8A%82%E7%82%B9%E7%BD%AE%E4%BA%8E%E5%85%B6%E4%B8%8B%E6%96%B9.png)
我正在尝试使用 latex 创建简历。我正在尝试将 MS word 中完成的一些内容复制到 latex 中。
下面是我试图复制的图像
到目前为止我已经使用了以下代码
\documentclass{article}
%\pagestyle{empty} % Suppress page numbers
\usepackage{tikz}
\usepackage{xcolor}
\pagenumbering{gobble}
\definecolor{darkgray}{HTML}{394456}
\definecolor{white}{RGB}{255,255,255}
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
\node [rectangle, fill=darkgray, anchor=north, minimum width=\paperwidth, minimum height=3cm] (box) at (current page.north){};
\node [anchor=east] (name) at (box) {%
\fontsize{45pt}{65pt}\color{white}%
{\textbf{John Doe}}
};
%\node [anchor=east] (name) at (box) {%
% \fontsize{30pt}{30pt}\color{white}%
% {\textbf{Job Title}}
%};
\end{tikzpicture}
\vspace{1cm}
\vspace{-2\parskip}
\end{document}
我是 Latex 的新手,我想知道如何将名称移动到左上角,就像我试图复制的图像中所示的那样,以及如何更改字体类型?
我在我的代码中注释了一段代码,导致Name
和重叠Job title
。我怎样才能将其移到名称下方?
第三点也是最后一件事,我如何添加节点以将图片添加到最右中部?
答案1
欢迎光临!喜欢吗?
\documentclass{article}
%\pagestyle{empty} % Suppress page numbers
\usepackage{tikz}
\pagenumbering{gobble}
\definecolor{darkgray}{HTML}{394456}
\definecolor{white}{RGB}{255,255,255}
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
\node [rectangle, fill=darkgray, anchor=north, minimum width=\paperwidth, minimum height=3cm] (box) at (current page.north){};
\node [text=white,font=\fontsize{45pt}{65pt}\bfseries\sffamily,anchor=north
west] (name) at ([xshift=2em,yshift=-2em]box.north west) {%
John Doe
};
\node [text=blue!20,font=\fontsize{15pt}{15pt}\bfseries\sffamily,anchor=north
west] (name) at ([xshift=0.5ex]name.south west) {%
Job title
};
\node[anchor=east] at ([xshift=-2em]box.east)
{\includegraphics[height=2cm]{example-image-duck}};
\end{tikzpicture}
\end{document}
答案2
这个可以吗?
\documentclass{article}
\pagestyle{empty} % Suppress page numbers
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[font=\sffamily,remember picture,overlay]
\path (current page.north west) node[below right,fill=darkgray,minimum width=\paperwidth,minimum height=3cm] (box){};
\path (box.west) node[right=5mm,align=left]
{{\fontsize{45pt}{65pt}\color{white}\textbf{Ivanka Trump}}\\[2mm]
{\fontsize{30pt}{20pt}\color{cyan}Advisor to POTUS}\\[2mm]
{\fontsize{10pt}{10pt}\color{white}workforce development \& entrepreneurship}};
% image and info from https://twitter.com/IvankaTrump/photo
\path (box.east)--++(180:2.5) coordinate (img);
\begin{scope}
\clip (img) circle(1);
\path (img) node[circle,scale=.15]{\includegraphics{ivanka.jpg}};
\end{scope}
\end{tikzpicture}
\end{document}