13

I have a problem with the following code:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[czech]{babel}
\usepackage{listings}
\usepackage{color}
\begin{document}
\uv{Tento text je v českých uvozovkách a zároveň je v něm použita diakritika}
Písmo jde v LaTeXu různě měnit. Můžeme psát \textsf{nepatkovým písmem}, \textbf{tučně}, \textit{kurzívou}.
Samozřejmě jde měnit i velikost. \Large Velikost \scriptsize může \Huge být \small opravdu \normalsize různá.
Zdrojový kód na vykreslení trojúhelníku. Snaha o podobnost s NetBeans.
\lstset{
backgroundcolor=\color{white},
basicstyle=\color{black},
keywordstyle=\color{red},
language=Java,
rulecolor=\color{black},
stringstyle=\color{orange}}  
\begin{lstlisting}[frame=single] 
package seminar1_ukol1;
public class Seminar1_ukol1 {
public static void main(String[] args) {
    int lokalniPromenna = 6;
    for (int i = 1; i <= lokalniPromenna; i++) {
        if (i == 1) {
            for (int j = 1; j < lokalniPromenna;
                    j++) {
                System.out.print(" ");
            }
            System.out.print("*");
        } else if (i == lokalniPromenna) {
            for (int j = 1; j <= lokalniPromenna;
                    j++) {
                System.out.print("*");
            }
        } else {
            for (int j = 1; j <= lokalniPromenna - i;
                    j++) {
                System.out.print(" ");
            }
            System.out.print("*");
            for (int j = lokalniPromenna - i + 1;
                    j < lokalniPromenna - 1;
                   j++) {
                System.out.print(" ");
            }
            System.out.print("*");
        }
        System.out.println();
    }
}
}
\end{lstlisting}

\end{document}

When I ran my code. I saw this mistake: Everywhere, where I used

System.out.print(".....

! LaTeX Error: Undefined color `orange'.See the LaTeX manual or LaTeX Companion for explanation.Type H  for immediate help.... System.out.print("
1
  • 5
    Try \usepackage{xcolor} instead of \usepackage{color} . That works.
    – sgmoye
    Commented Dec 11, 2015 at 17:39

1 Answer 1

28

I'll make my comment into an answer: Try \usepackage{xcolor} in place of \usepackage{color}. xcolor.sty is a much richer, more feature-packed package.

0

You must log in to answer this question.

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