我是 LaTeX 新手。我正在使用moderncv
带有 style 的包编写简历banking
。我想添加一张照片。运行编译命令后,它正常退出,但照片没有出现在页面上。
我的代码如下:
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.8]{geometry}
\usepackage{import}
\usepackage{booktabs}
\usepackage{xcolor}
\usepackage{tabularx}
\name{Name}{Last Name} % My name is quite long, can it be the problem?
\title{Resume}
\address{Address}
\phone[mobile]{my_number}
\email{my_e-mail}
\photo[64pt][0pt]{name_of_the_phot}
\setlength\tabcolsep{10pt}
\begin{document}
\makecvtitle
\end{document}
有没有关于如何添加照片并随后更改其位置的帮助?我希望它出现在右侧或左侧。
提前致谢。
答案1
为了获得右侧的图像,您可以修补为 cv 创建头部的现有方法。
为了获得左边的图像,您需要使用表格(例如)完全重写创建头部的方法。
因为我认为左边的图像看起来不太好看,所以我向您展示了获取右侧图像的可能性。
使用以下补丁
\patchcmd{\makehead}% <cmd>
{\\[2.5em]}% <search>
{\hfill\raisebox{-1.9cm}[0pt][0pt]{\includegraphics[width=.18\textwidth]{example-image-10x16}}\\[2.5em]}% <replace>
{}{}% <success><failure>
您在右侧添加图像。图像的位置通过 进行校正\raisebox{-1.9cm}[0pt][0pt]{
。1.9cm
根据您的需要进行更改。
图像的宽度为width=.18\textwidth
。这是因为标题的布局限制了头部的长度\setlength{\makeheaddetailswidth}{0.8\textwidth}
,这意味着0.8\textwidth
如果您想要或需要更改此设置,请首先使用以下补丁:
\patchcmd{\makehead}% <cmd>
{\setlength{\makeheaddetailswidth}{0.8\textwidth}}% <search>
{\setlength{\makeheaddetailswidth}{0.7\textwidth}}% <replace> % <=============
{}{}% <success><failure>
width
根据您的需要改变用法。
以下 MWE
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{banking} % head 3 body 3
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.8]{geometry}
\usepackage{import}
\usepackage{booktabs}
\usepackage{xcolor}
\usepackage{tabularx}
\name{John}{Doe}
\title{Resumé title}
\address{street and number}{postcode city}{country}
\phone[mobile]{+1~(234)~567~890}
\phone[fixed]{+2~(345)~678~901}
\phone[fax]{+3~(456)~789~012}
\email{[email protected]}
\homepage{www.johndoe.com}
\social[linkedin]{john.doe}
\social[twitter]{jdoe}
\social[github]{jdoe}
\extrainfo{additional information}
\quote{Some quote}
\setlength\tabcolsep{10pt}
%\patchcmd{\makehead}% <cmd>
%{\setlength{\makeheaddetailswidth}{0.8\textwidth}}% <search>
%{\setlength{\makeheaddetailswidth}{0.7\textwidth}}% <replace>
%{}{}% <success><failure>
\patchcmd{\makehead}% <cmd>
{\\[2.5em]}% <search>
{\hfill\raisebox{-1.9cm}[0pt][0pt]{\includegraphics[width=.18\textwidth]{example-image-10x16}}\\[2.5em]}% <replace>
{}{}% <success><failure>
\begin{document}
\makecvtitle
\section{Education}
\cventry{year--year}{Degree}{Institution--3}{City--4}{\textit{Grade}--5}{Description--6} % arguments 3 to 6 can be left empty
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}
\section{Master thesis}
\cvitem{title}{\emph{Title}}
\cvitem{supervisors}{Supervisors}
\cvitem{description}{Short thesis abstract}
\section{Experience}
\subsection{Vocational}
\cventry{year--year}{Job title}{Employer}{City}{}{General description
no longer than 1--2 lines.\newline{}%
Detailed achievements:%
\begin{itemize}%
\item Achievement 1;
\item Achievement 2, with sub-achievements:
\begin{itemize}%
\item Sub-achievement (a);
\item Sub-achievement (b), with sub-sub-achievements (don't do this!);
\begin{itemize}
\item Sub-sub-achievement i;
\item Sub-sub-achievement ii;
\item Sub-sub-achievement iii;
\end{itemize}
\item Sub-achievement (c);
\end{itemize}
\item Achievement 3.
\end{itemize}}
\cventry{year--year}{Job title}{Employer}{City}{}{Description
line 1\newline{}Description line 2}
\subsection{Miscellaneous}
\cventry{year--year}{Job title}{Employer}{City}{}{Description}
\end{document}
给出结果页面:
moderncv
顺便说一句:如果您使用的是版本 2,则可以编译给定的代码。