1

This question already has an answer here:

I'm new to LaTeX and quite impressed with this program! So, I'm willing to concede not being entirely certain that the issue I'm having has to do with data types, or just using \includegraphics{} quirks, but here's my dilemma.

I have looked at this answer regarding \includegraphics but it didn't sort-of solve my issue.

I have a document using the memoir class:

\documentclass[a5paper, 11pt, onecolumn, openany]{memoir}

I use a custom style .sty file:

\usepackage{KeysToLife}

I wish to use a UDF (\imgpb = image plus page break) that I define in the .sty with a couple of arguments. The first argument is the name and path of the image file, which would be in the form of "./img/Flourish.png". The second argument is the scale value for that image, which could in the the form of 0.6 or .8 or something along those lines. Here is the \newcommand code I came up with:

\newcommand{\imgpb}[2]{
\begin{center}
\includegraphics[scale={#2}]{#1}
\end{center}
\pagebreak
}

This typically would get called from within the document in this manner:

\imgpb{./img/Flourish02.png,0.6}

The error in TexMaker states "Paragraph ended before \Gin@ii was complete. \par

I'm at a bit of a loss how to proceed. When I call the function with just one argument:

\imgpb{./img/Flourish02.png}

it executes just fine... just appears to have a problem with the second argument. Which is of data type double, in Python terms. Am I barking up the wrong tree?

The full document (with issues) is here as a zip file:

The Zip file

Edited to Announce as SOLVED:

Thanks to Marmot and Werner who pointed out the solution. You send arguments, instead of comma-delimited, as separated in curly-brackets:

\imgpb{./img/Flourish02.png}{.6}

Sorted.

I will endeavour to do due diligence in researching the question before I ask the next one.

marked as duplicate by Werner macros Feb 2 at 5:19

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Welcome to TeX.SE! Try \imgpb{./img/Flourish02.png}{0.6}. That is, the arguments are not separated by commas. – user121799 Feb 2 at 5:11
  • This was just handled here: Strange error defining a macro with arguments for math mode – Werner Feb 2 at 5:19
  • Thank you for your answer, Marmot. That worked exactly as I needed it to. I thought I was doing due diligence on researching my problem but clearly, it helps to know how to ask the question. – RobinsSea Feb 2 at 22:45

Browse other questions tagged or ask your own question.