1

I got an assignment where i have to explain some code and to do that i have to show my code as normal text. I have no idea how to show my code so is there anyone that could show me how it's done?

\begin{enumerate}
\item test.
\item test.
\item test.
\end{enumerate}
  • 2
    Welcome to TeX.SE...Can you elaborate your requirement? Like posting screenshot, etc... – MadyYuvi Oct 11 '19 at 11:55
  • Only the code? Not also the results like here or here? – Fran Oct 11 '19 at 18:55
1

Try with \verbatim:

\documentclass{book}

\begin{document}

\begin{verbatim}
\begin{enumerate}
\item test.
\item test.
\item test.
\end{enumerate}
\end{verbatim}

\end{document}

You can also do it with \listings

\documentclass{article}

\usepackage{listings}

\begin{document}

\begin{lstlisting}
\begin{enumerate}
\item test.
\item test.
\item test.
\end{enumerate}
\end{lstlisting}

\end{document}

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.