/Newcommand how to add a picture with specific allignment

In the code you see below I would like to add the option of introducing a picture right after the "employer"/"position" sections. Do you have any idea of how I could achieve that? (package+implementation within the \newcommand). Below you have a picture of the desired result:

    % Command for entering a new work position
\newcommand{\workposition}[5]{
{\raggedleft\textsc{#1\expandafter\ifstrequal\expandafter{#2}{}{}{\hspace{6pt}\footnotesize{(#2)}}}\par} % Duration and conditional full time/part time text
\expandafter\ifstrequal\expandafter{#3}{}{}{{\raggedright\large #3}\\}
% Employer
\expandafter\ifstrequal\expandafter{#4}{}{}{{\raggedright\large\textit{\textbf{#4}}}\\[4pt]} % Job title
\expandafter\ifstrequal\expandafter{#5}{}{}{#5\\} % Description
}

• Welcome to TeX.SX! Please help us (and also you) and add a minimal working example (MWE), that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass and ending with \end{document}. Aug 4, 2018 at 14:22

Here is a solution of mine using minipage and includegraphics:

\documentclass{article}
\usepackage{etoolbox}
\usepackage{graphicx}
\newcommand{\workposition}[6]{
{\raggedleft\textsc{#1\expandafter\ifstrequal\expandafter{#2}{}{}{
\hspace{6pt}\footnotesize{(#2)}}}\par
} % Duration and conditional full time/part time text
\begin{minipage}[T]{3cm}%
\expandafter\ifstrequal\expandafter{#3}{}{}{
{\raggedright\large #3}\\}%Job Title
\expandafter\ifstrequal\expandafter{#5}{}{}{%
{\raggedright\large\textit{\textbf{#5}}}%Employer
}
\end{minipage}
\expandafter\ifstrequal\expandafter{#4}{}{}{
\begin{minipage}[T]{0.5\textwidth}%
\includegraphics[height=30pt]{#4}% Logo
\end{minipage}\\[4pt]%
}
\expandafter\ifstrequal\expandafter{#6}{}{}{#6\\} % Description
}

\begin{document}

\workposition{potatoes}{potatoes}{potatoes}{logo}{potatoes}{potatoes}

\end{document}


EDIT:

Alternatively, if you want the image close to the employer's name you could use tabular instead of minipage. Here is an example.

\documentclass{article}
\usepackage{etoolbox}
\usepackage{graphicx}
\newcommand{\workposition}[6]{
{\raggedleft\textsc{#1\expandafter\ifstrequal\expandafter{#2}{}{}{
\hspace{6pt}\footnotesize{(#2)}}}\par
} % Duration and conditional full time/part time text
\noindent\begin{tabular}{l}
\expandafter\ifstrequal\expandafter{#3}{}{}{%
{\raggedright\large #3}\\}%Job Title
\expandafter\ifstrequal\expandafter{#5}{}{}{%
{\raggedright\large\textit{\newline\textbf{#5}}}%Employer
}%
\end{tabular}
\expandafter\ifstrequal\expandafter{#4}{}{}{
\begin{minipage}[T]{0.5\textwidth}%
\includegraphics[height=30pt]{#4}% Logo
\end{minipage}\\[4pt]%
}\\[4pt]
\expandafter\ifstrequal\expandafter{#6}{}{}{#6\\} % Description
}

\begin{document}

\workposition{potatoes}{potatoes}{potatoes}{logo}{potatoes}{potatoes}

\end{document}

• Hi, thanks for replying. The only problem with this solution is that the picture is not positioned right next to the text but more in the middle. Do you have any workaround for that? Aug 4, 2018 at 18:50
• You could use tabular instead of minipage. I edited the answer to include an example. Aug 4, 2018 at 22:37
• Glad it helped ^^ Aug 5, 2018 at 6:54