我正在尝试使用 tabularx 插入图像\insertgraphics{}
,但我在互联网上找到的解决方案似乎都不起作用。为此,我使用了一个包含多个命令的类,然后在 Latex 文档中调用这些命令。
创建图像的命令在类中是硬编码的,图像位于名为的文件夹中img
。我收到了几个错误,但第一个是!Undefined control sequence
。
我使用的类如下:
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{tccv}
[2012/11/09 v1.0
Two Column Curriculum Vitae]
\LoadClass[10pt]{scrartcl}
\setcounter{secnumdepth}{-1}
\RequirePackage[hmargin=1.25cm,vmargin=1.25cm,twocolumn,columnsep=1.25cm]{geometry}
\RequirePackage{bookman,etoolbox,hyperref,needspace,tabularx,xcolor,fontawesome,makecell,graphicx}
\pagestyle{empty}
\setlength\parindent{0pt}
\color[HTML]{303030} % Default foreground color
\definecolor{link}{HTML}{506060} % Hyperlinks
\hypersetup{colorlinks,breaklinks,urlcolor=link,linkcolor=link}
\setkomafont{disposition}{\color[HTML]{0058B6}}
\setkomafont{section}{\scshape\Large\mdseries}
% In tccv \part must contain the subject of the curriculum vitae.
% The command will start a new page and output in onecolumn the
% subject (first and last name) with the hardcoded text
% "Curriculum vitae" under it.
\renewcommand\part[2]{%
\twocolumn[%
\vskip-\lastskip%
\begin{tabularx}{\linewidth}{ c@{\hskip 0.25in} | X | X }
{\usekomafont{part} \hfill #1} & {#2} & {\begin{minipage}{0.45\textwidth}\includegrafics[width=\textwidth]{img/qrcode.png}\end{minipage}}
\end{tabularx}
\bigskip]}
% Renders a personal data box:
%
% |[
% \personal[optional: web site without scheme (no http:// prefix)]
% {address}{phone number}{email}
% ]|
\newcommand\personal[4][]{%
%\needspace{0.5\textheight}%
\newdimen\boxwidth%
\boxwidth=\dimexpr\linewidth-2\fboxsep\relax%
\colorbox[HTML]{C7E2F2}{%
\begin{tabularx}{\boxwidth}{c X}
\faMapMarker & {#2}\smallskip\\
\faPhone & {#3}\smallskip\\
\faEnvelope & \href{mailto:#4}{#4}
\ifstrempty{#1}{}{\smallskip\\ \faLinkedin & \href{http://www.#1}{#1}}
\end{tabularx}}}
我使用的乳胶文档是:
\documentclass{tccv}
\usepackage[english]{babel}
\usepackage{fontawesome}
\usepackage[gen]{eurosym}
\begin{document}
\part{\makecell[r]{Name \\ Surname}}{\personal
[linkedin.com]
{Address }
{+33 555 55 55 55}
{[email protected]}}
\end{document}
答案1
该命令不是\includegraphics
,\includegrafics
但你也不应该有周围的小页面
如果你想控制注释中提到的对齐方式,最简单的方法是使用adjustbox
包及其选项来添加额外的键,然后\includegraphics
你可以指定类似的内容valign=t
答案2
@DavidCarlisle 在他的评论中已经给出了想法。下面是经过修改的.cls
文件,其中包含所需的更正。
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{tccv}
[2012/11/09 v1.0
Two Column Curriculum Vitae]
\LoadClass[10pt]{scrartcl}
\setcounter{secnumdepth}{-1}
\RequirePackage[hmargin=1.25cm,vmargin=1.25cm,twocolumn,columnsep=1.25cm]{geometry}
\RequirePackage{bookman,etoolbox,hyperref,needspace,tabularx,xcolor,fontawesome,makecell,graphicx}
\RequirePackage[export]{adjustbox}
\pagestyle{empty}
\setlength\parindent{0pt}
\color[HTML]{303030} % Default foreground color
\definecolor{link}{HTML}{506060} % Hyperlinks
\hypersetup{colorlinks,breaklinks,urlcolor=link,linkcolor=link}
\setkomafont{disposition}{\color[HTML]{0058B6}}
\setkomafont{section}{\scshape\Large\mdseries}
% In tccv \part must contain the subject of the curriculum vitae.
% The command will start a new page and output in onecolumn the
% subject (first and last name) with the hardcoded text
% "Curriculum vitae" under it.
\renewcommand\part[2]{%
\twocolumn[%
\vskip-\lastskip%
\begin{tabularx}{\linewidth}{ c@{\hskip 0.25in} | X | X }
{\usekomafont{part} \hfill #1} & {#2} & {\includegraphics[width=.1\textwidth,valign=m]{example-image}}
\end{tabularx}
\bigskip]}
% Renders a personal data box:
%
% |[
% \personal[optional: web site without scheme (no http:// prefix)]
% {address}{phone number}{email}
% ]|
\newcommand\personal[4][]{%
%\needspace{0.5\textheight}%
\newdimen\boxwidth%
\boxwidth=\dimexpr\linewidth-2\fboxsep\relax%
\colorbox[HTML]{C7E2F2}{%
\begin{tabularx}{\boxwidth}{c X}
\faMapMarker & {#2}\smallskip\\
\faPhone & {#3}\smallskip\\
\faEnvelope & \href{mailto:#4}{#4}
\ifstrempty{#1}{}{\smallskip\\ \faLinkedin & \href{http://www.#1}{#1}}
\end{tabularx}}}
现在,编译你的代码:
\documentclass{tccv}
\usepackage[english]{babel}
\usepackage{fontawesome}
\usepackage[gen]{eurosym}
\begin{document}
\part{\makecell[r]{Name \\ Surname}}{\personal
[linkedin.com]
{Address }
{+33 555 55 55 55}
{[email protected]}}
\end{document}
给出结果: