user12881666
user12881666

Reputation:

it doesn't show the figure but just a frame and inside the file name, although the image file is uploaded in the same folder on overleaf

May the problem consist in wrong packages? The image was uploaded successfully in the folder I tried even with the function wrapfigure but the result is the same. And I tried to use the image not through the \newcommand but it cannot be read properly anyway.

\documentclass[12pt,a4paper,oneside,draft]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{imakeidx}
\makeindex[columns=3, title=Alphabetical Index, intoc]
\usepackage{graphics}
\usepackage{graphicx}
\usepackage{wrapfig}

\graphicspath{ {images/} }

        
\usepackage [a4paper,top=2cm,bottom=0cm,left=1cm,right=1cm]{geometry}
\textheight=5000px                    % Saving trees ;-)
\usepackage{url}


%%% Macros
%%% ------------------------------------------------------------
\newlength{\spacebox}
\settowidth{\spacebox}{8888888888}          % Box to align text
\newcommand{\sepspace}{\vspace*{15em}}      % Vertical space macro

\newcommand{\titolo}[4]{

**\begin{figure}[t]
\includegraphics[width=5cm]{logoPolimi.png}
\centering
\end{figure}**

%\vspace*{15em}
\sepspace

\centering\textbf{\huge{#1}}
\vspace{15em}

\centering\textbf{#2}

\vspace{2em}
\textbf{#3}

\vspace{2em}
\textbf{#4}}



\usepackage{caption}
%\pagenumbering{roman}
\begin{document}



 \titolo{Digital Channel}{Mario Rossi}{Management Engineering}{Politecnico di Milano}
 

  \end{document}

Thanks in advance

Upvotes: 2

Views: 2300

Answers (1)

The figure does not appear, because you are using draft as document class option.

Unrelated to your problem, but

  • font commands like \huge are switches and don't take an argument. So instead of \huge{...}, you should use {\huge ...}

  • you don't need the graphics package if you also load graphicx

  • if your tex distribution is up to date, you can also skip \usepackage[utf8]{inputenc} because this is the default for some years


\documentclass[12pt,a4paper,oneside,
%draft
]{article}
%\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{imakeidx}
\makeindex[columns=3, title=Alphabetical Index, intoc]
%\usepackage{graphics}
\usepackage{graphicx}
\usepackage{wrapfig}

\graphicspath{ {images/} }

        
\usepackage [a4paper,top=2cm,bottom=0cm,left=1cm,right=1cm]{geometry}
\textheight=5000px                    % Saving trees ;-)
\usepackage{url}


%%% Macros
%%% ------------------------------------------------------------
\newlength{\spacebox}
\settowidth{\spacebox}{8888888888}          % Box to align text
\newcommand{\sepspace}{\vspace*{15em}}      % Vertical space macro

\newcommand{\titolo}[4]{

\begin{figure}[t]
\includegraphics[width=5cm]{example-image.png}
\centering
\end{figure}

%\vspace*{15em}
\sepspace

\centering\textbf{\huge #1}
\vspace{15em}

\centering\textbf{#2}

\vspace{2em}
\textbf{#3}

\vspace{2em}
\textbf{#4}}



\usepackage{caption}
%\pagenumbering{roman}
\begin{document}



 \titolo{Digital Channel}{Mario Rossi}{Management Engineering}{Politecnico di Milano}
 







  \end{document}

enter image description here

Upvotes: 3

Related Questions