新答案

新答案

我正在使用casual该包的 cv moderncv

我使用以下两条代码添加了图像:

\adjustbox{height=1em}{\adjustimage{height=3.5em,valign=t,set depth=0pt}{LOGO1.png}}

这里提供的解决方案

使用我得到的第一个代码: 在此处输入图片描述

第二句是这样的: 在此处输入图片描述

理想情况下,我希望有类似的东西: 在此处输入图片描述

有什么建议么:


可编译代码:

\documentclass[11pt,a4paper]{moderncv}
\moderncvtheme[blue]{casual}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{adjustbox}
\usepackage{xcolor}
\usepackage[english,ngerman]{babel}
\usepackage[ansinew]{inputenc}
\usepackage[super]{nth}
\usepackage[scale=0.8]{geometry}
\usepackage{graphicx}
\setlength{\hintscolumnwidth}{3.25cm}


%newcventry
\newcommand{\newcventry}[9][0.25em]{%
    \cvitem[#1]{#2}{%
        \ifthenelse{\equal{#7}{}}%
            {}{%                                        V-V arbitrary space
                \begin{minipage}[t]{\dimexpr\linewidth-#8-1em}%
                \vspace{-0.7em}%
        }%
        {\bfseries#3}% Title
        \ifthenelse{\equal{#4}{}}{}{\newline {\slshape#4}}% Name of the institution
        \ifthenelse{\equal{#5}{}}{}{, {\slshape#5}}% City
        \ifthenelse{\equal{#6}{}}{}{, {\slshape#6}}% Country
        \strut%
        \ifx&#9&% description
            \else{\newline{}\begin{minipage}[t]{\linewidth}\small#9\end{minipage}}\fi
        \ifthenelse{\equal{#7}{}}% image
        {}{%
        \end{minipage}\hfill%
    \begin{minipage}[t]{#8}% width of image
    \vspace{-0.7em}%
    \includegraphics[width=#8]{#7}%
    \end{minipage}%
  }%
  } }


\firstname{John}
\familyname{Doe}
\address{Somewhere}{Along there}
\mobile{+1 (800) 555-5555}
\email{[email protected]} 

\extrainfo{
\parbox{6cm}{
\centering
\httplink[\faLinkedin~John Doe]{www.linkedin.com/in/john-doe/}
\footsymbol \httplink[\faXing~John Doe]{www.xing.com/profile/John_Doe/} 
\httplink[\faGithub~JohnDoe]{github.com/JohnDoe}
\footsymbol \httplink[\faStackOverflow~John Doe]{stackoverflow.com/users/12345678/john-doe}
}}

\begin{document}
\maketitle

\section{Work Experience}
\cvline{xx.20xx - xx.20xx}{\textbf{Title}\hfill
\adjustbox{height=1em}{\adjustimage{height=3.5em,valign=t,set depth=0pt}{LOGO1.png}}
\newline
\textit{Company, That Location, Fancy City} \newline 
Very long and interesting description of what I did there. Responsible for \underline{\textbf{this}} and \underline{\textbf{that}} - this is just a very very very long text that has no relevance what so ever. Responsible for \underline{\textbf{this}} and \underline{\textbf{that}} - this is just a very very very long text that has no relevance what so ever.}

\newcventry{Date1 - Date2}{Very long name just to make things clearer}{Name of the institution}{Address of the institution}{number 6}{LOGO1.png}{11em}{Very long and interesting description of what I did there. Responsible for \underline{\textbf{this}} and \underline{\textbf{that}} - this is just a very very very long text that has no relevance what so ever. Responsible for \underline{\textbf{this}} and \underline{\textbf{that}} - this is just a very very very long text that has no relevance what so ever.}

\end{document}

答案1

新答案

可以用来insbox放置图形(效果insbox类似于wrapfig,但操作起来更容易,因此更容易精确定位。它仍然添加到\@InsertBoxMargin图像的顶部,导致与您想要的不完美对齐。所以我设置为\@InsertBoxMargin0pt 并使用宏自己添加填充\EnlargeBox,它有 2 个参数。第一个是一个标记列表。如果该列表包含,则l框将向左放大\InsertBoxMargin,如果包含,r则向右放大。如果它包含t在顶部,如果它包含b在底部。第二个参数是在 内部要排版的材料\hbox

它只对当前\cvline/有效\cvitem

\documentclass[11pt,a4paper]{moderncv}
\moderncvtheme[blue]{casual}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{xcolor}
\usepackage[english,ngerman]{babel}
%\usepackage[ansinew]{inputenc}
\usepackage[super]{nth}
\usepackage[scale=0.8]{geometry}
\usepackage{graphicx}
\setlength{\hintscolumnwidth}{3.25cm}
\input{insbox}
\usepackage{grabbox}

\firstname{John}
\familyname{Doe}
\address{Somewhere}{Along there}
\mobile{+1 (800) 555-5555}
\email{[email protected]} 

\extrainfo{
\parbox{6cm}{
\centering
\httplink[\faLinkedin~John Doe]{www.linkedin.com/in/john-doe/}
\footsymbol \httplink[\faXing~John Doe]{www.xing.com/profile/John_Doe/} 
\httplink[\faGithub~JohnDoe]{github.com/JohnDoe}
\footsymbol \httplink[\faStackOverflow~John Doe]{stackoverflow.com/users/12345678/john-doe}
}}
\makeatletter
\newlength\InsertBoxMargin
\InsertBoxMargin=\@InsertBoxMargin
\@InsertBoxMargin=0pt
\newsavebox\EnlargeBox@box
\long\def\afterfiAn\else#1\fi#2{\fi}
\long\def\afterfiBy\fi#1{\fi#1}
\newcommand\IfTokenInList@define[1]
  {%
    \def\IfTokenInList@test##1#1##2\q@stop
      {%
        \if\relax\detokenize{##2}\relax
          \afterfiAn
        \else
          \afterfiBy
        \fi
      }%
  }
\newcommand\IfTokenInList[2]
  {%
    \IfTokenInList@define{#1}%
    \IfTokenInList@test#2#1\q@stop
  }
\newcommand\EnlargeBox[1]
  {%
    \begingroup
    \grabbox\EnlargeBox@box[\IfTokenInList{l}{#1}{\hskip\InsertBoxMargin}]%
    \hbox[\IfTokenInList{r}{#1}{\hskip\InsertBoxMargin}]%
      {%
        \IfTokenInList{t}{#1}
          {%
            \ht\EnlargeBox@box
              \dimexpr\InsertBoxMargin+\ht\EnlargeBox@box\relax
          }%
        \IfTokenInList{b}{#1}
          {%
            \dp\EnlargeBox@box
              \dimexpr\InsertBoxMargin+\dp\EnlargeBox@box\relax
          }%
        \box\EnlargeBox@box
        \endgroup
      }%
  }
\makeatother



\begin{document}
\maketitle

\section{Work Experience}
\cvline{xx.20xx - xx.20xx}{%
  \InsertBoxR{0}{\EnlargeBox{lb}{\includegraphics[width=.23\textwidth]{example-image-duck}}}
\textbf{Title}
  \newline 
\textit{Company, That Location, Fancy City} \newline 
Responsible for \underline{\textbf{this}} and \underline{\textbf{that}} and
also everything else that is interesting}

\cvline{xx.20xx - xx.20xx}{
\textbf{Title} \newline 
\textit{Company, That Location, Fancy City} \newline 
Responsible for \underline{\textbf{this}} and \underline{\textbf{that}}}
\end{document}

在此处输入图片描述


旧答案

用于adjustbox将图像设置为深度为零且顶部对齐。这样它不会占用垂直空间,因此可能会与其他内容重叠。

\documentclass[11pt,a4paper]{moderncv}
\moderncvtheme[blue]{casual}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{adjustbox}
\usepackage{xcolor}
\usepackage[english,ngerman]{babel}
\usepackage[ansinew]{inputenc}
\usepackage[super]{nth}
\usepackage[scale=0.8]{geometry}
\usepackage{graphicx}
\setlength{\hintscolumnwidth}{3.25cm}

\firstname{John}
\familyname{Doe}
\address{Somewhere}{Along there}
\mobile{+1 (800) 555-5555}
\email{[email protected]} 

\extrainfo{
\parbox{6cm}{
\centering
\httplink[\faLinkedin~John Doe]{www.linkedin.com/in/john-doe/}
\footsymbol \httplink[\faXing~John Doe]{www.xing.com/profile/John_Doe/} 
\httplink[\faGithub~JohnDoe]{github.com/JohnDoe}
\footsymbol \httplink[\faStackOverflow~John Doe]{stackoverflow.com/users/12345678/john-doe}
}}

\begin{document}
\maketitle

\section{Work Experience}
\cvline{xx.20xx - xx.20xx}{
\textbf{Title}\hfill
\adjustimage{width=.23\textwidth,valign=t,set depth=0pt}{example-image-duck}
  \newline 
\textit{Company, That Location, Fancy City} \newline 
Responsible for \underline{\textbf{this}} and \underline{\textbf{that}}}

\cvline{xx.20xx - xx.20xx}{
\textbf{Title} \newline 
\textit{Company, That Location, Fancy City} \newline 
Responsible for \underline{\textbf{this}} and \underline{\textbf{that}}}
\end{document}

在此处输入图片描述

答案2

总是有正确的方法,以及工作方式...所以我非常确定有一个很好的、更优雅的解决方案。

这里我只是添加了一个\vspace{-4ex}并删除了那个wrapfigure

负空间

\documentclass[11pt,a4paper]{moderncv}
\moderncvtheme[blue]{casual}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{wrapfig}
\usepackage{xcolor}
\usepackage[english,ngerman]{babel}
\usepackage[ansinew]{inputenc}
\usepackage[super]{nth}
\usepackage[scale=0.8]{geometry}
\usepackage{graphicx}
\setlength{\hintscolumnwidth}{3.25cm}

\firstname{John}
\familyname{Doe}
\address{Somewhere}{Along there}
\mobile{+1 (800) 555-5555}
\email{[email protected]} 

\extrainfo{
\parbox{6cm}{
\centering
\httplink[\faLinkedin~John Doe]{www.linkedin.com/in/john-doe/}
\footsymbol \httplink[\faXing~John Doe]{www.xing.com/profile/John_Doe/} 
\httplink[\faGithub~JohnDoe]{github.com/JohnDoe}
\footsymbol \httplink[\faStackOverflow~John Doe]{stackoverflow.com/users/12345678/john-doe}
}}

\begin{document}
\maketitle

\section{Work Experience}
\cvline{xx.20xx - xx.20xx}{
        \begin{flushright}
        \vspace{-4ex}
        \includegraphics[width=0.23\textwidth]{example-image-a}
        \end{flushright}}
{\vspace{-18ex}
\textbf{Title} \newline 
\textit{Company, That Location, Fancy City} \newline 
Responsible for \underline{\textbf{this}} and \underline{\textbf{that}}

\textbf{Title} \newline 
\textit{Company, That Location, Fancy City} \newline 
Responsible for \underline{\textbf{this}} and \underline{\textbf{that}}
}

\end{document}

相关内容