0

I tried a picture next to the \maketitle like in this question. But I make bigger the size of picture and the title is hidden behind the picture. What should I edit? Next problem is that I have only black rectangle instead of picture. How to add a picture? I thought that \vspace{0pt}\includegraphics[width=5.503cm,height=4.654cm]{m.png} last braces is a name of picture. Thank you

\documentclass{article}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\newcommand{\mytitle}[1]{\LARGE \textbf{#1}\par}
\newcommand{\mysubtitle}[1]{\large\textbf{#1}\par}
\newcommand{\mydate}[1]{\small #1\par}
\usepackage[demo]{graphicx}


\begin{document}

\noindent%
\begin{minipage}[t]{.3\textwidth}
\vspace{0pt}\includegraphics[width=5.503cm,height=4.654cm]{m.png}
\end{minipage}%
\begin{minipage}[t]{.7\textwidth}
\vspace{20pt}
\mytitle{Title}
\mydate{\today}
\end{minipage}

\end{document}

enter image description here

  • 1
    the black rectangle is because you have \usepackage[demo]{graphicx} remove demo, for the rest remove [width=5.503cm,height=4.654cm (which would distort the image) just specify [width=\linewidth] so the image scales to fit. – David Carlisle Apr 13 at 16:26
  • Thank you and how to set a space between figure and title? Or how to get figure to the right side of the page? – Lukáš Altman Apr 13 at 16:39
  • 1
    you have made two minipage with no space between them adding up to textwidth, if you want a space change the width from .3\textwidth to (say) .25\textwidth and change \end{minipage}% to \end{minipage}\hfill to put hfill space betwween the minipages – David Carlisle Apr 13 at 16:42
  • I added a picture to my question, do we mean the same space? – Lukáš Altman Apr 13 at 16:46
  • 1
    yes if you want a gap you need to make one of the minpage smaller, I suggested reducing the image, you could of course reduce the size of the second minipage with the title text instead. – David Carlisle Apr 13 at 17:02
1

enter image description here

I noted the changes in code comments below

\documentclass{article}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\newcommand{\mytitle}[1]{\LARGE \textbf{#1}\par}
\newcommand{\mysubtitle}[1]{\large\textbf{#1}\par}
\newcommand{\mydate}[1]{\small #1\par}
% just rectangles \usepackage[demo]{graphicx}

\usepackage{graphicx}


\begin{document}

\noindent%
%.3+.7 leaves no gap
\begin{minipage}[t]{.25\textwidth}
\vspace{0pt}
%%%%% height and width distorts \includegraphics[width=5.503cm,height=4.654cm]{m.png}
\includegraphics[width=\linewidth]{example-image}
\end{minipage}%
\hfill % space between the minipages
\begin{minipage}[t]{.65\textwidth}
\vspace{20pt}
\mytitle{Title}
\mydate{\today}
\end{minipage}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.