Several weeks ago, I asked a question about a LaTeX macro to insert an image in a document using an IF statement. The solution worked perfectly. Now I have a similar issue. I have the following macro:



\newcommand{\nb}{"Text Analytics Using Python_Page_"}

is the the image to be inserted in the document. I use this in the document as, for example:


I want to modify this so that to be:

\notebook{1, This is an example notebook.} 
\notebook{12, You can see from this notebook that XXX.}

Basically, I want to omit the double quotes around the image number (the "01" and "12") and I want to add some text below the image in the document. For the latter, I tried adding a second argument in the macro definition, but it didn't work. Any help with is is appreciated.

Walt Paczkowski

I'm using LaTeX on a Windows 10 laptop.


use a simpler call:

\notebook{1, This is some text.}
\notebook{12} Somme example text.}
  • Can you make a minimal working example (MWE) that shows which packages you use? – user36296 Jun 6 at 22:12
  • 1
    In general you would save yourself from many problems if you would not use special characters like spaces or underscores in image names. – user36296 Jun 6 at 22:13
  • Why are you adding the quotes? – egreg Jun 7 at 10:42
  • the usual tex method to pass multiple arguments to a macro is \macroname{arg1}{arg2} rather than a comma separated list.

  • the "" around 01 should not be necessary because the problematic characters (spaces and _) are in the part of the filename, which is stored in \nb. It should be enough to enclose this part in quotation marks. Of course the much better approach would be not use such characters in filenames...





\newcommand{\nb}{"test test_"}


\notebook{01}{This is an example notebook.}
\notebook{12}{You can see from this notebook that XXX.}

  • This worked perfectly. Thanks for the help. Walt – Walt Jun 7 at 15:06

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.