0

I want a piece of code to be monospaced. So I do the following. Commands are highlighted in Eclipse. But as soon as I type \verbatim all inside and the color of the command itself become gray.

\begin{verbatim}

 public class main {
 public statik void main (string[] args){
     for(int i = 0; i < arg.length; i ++){
         System.out.println(args[i]);
     }
   }
 };

\end{verbatim}

The following packages are included. \usepackage{verbatim} \usepackage{alltt}

What am I doing wrong?

auden
  • 1,458

1 Answers1

0

In order to use verbatim you don't have to use any packages, the code below works for me.

\documentclass[10pt]{article}

\begin{document}

\begin{verbatim}

public class main {
public static void main (string[] args){
     for(int i = 0; i < arg.length; i ++){
         System.out.println(args[i]);
     }
   }
 };

\end{verbatim}

\end{document}

I am using miktex in windows.

Arr
  • 1