8

Following this: Make two-columned list start at same line as its section, I did:

\documentclass{article}

\usepackage{cprotect}
\usepackage{tasks}

\begin{document}

    \section{Languages}
     \begin{tasks}[label = \textbullet](2)
        \task C{}\verb!++!.
        \task German (B1)
        \task Italian (A1)
        \task Greek (native)
    \end{tasks}

\end{document}

which results in the error:

./foo.tex:14: LaTeX Error: \verb illegal in command argument.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.14     \end{tasks}

? 

I read this: How to put \verb command inside of \textbf{} block?, but was still unable to apply the solution, I tried:

\task \cprotect C{}\verb!++!.

but that resulted in:

Runaway argument?
{\task }{,label = \textbullet }{2} \task 
./foo.tex:10: Forbidden control sequence found while scanning use of \tasks.
<inserted text> 
                \par 
l.10         \task \cprotect
                             C{}\verb!++!.
? 

How to fix this?

1

1 Answer 1

12

Use this:

\usepackage{fancyvrb}
\newcommand\Cpp{C\Verb!++!}

But why not a simple C{}\texttt{++}?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .