I want to show some .ini file in my work. The ini file works with squared brackets. I try to use \lstdefinelanguage but I can't handle it. That is what I try before and in my understanding it should work but it doesn't:
\documentclass{article}
\usepackage{color}
\usepackage{listings}
\lstdefinelanguage{Ini}
{
tag=[s][],
tagstyle=\color{blue}\bfseries,
usekeywordsintag=true
}
\lstset{
language=Ini
}
\begin{document}
\begin{lstlisting}
[test]
a=15
b=4
[test1]
c=25
d=5
[test2]
e=50
f=5
\end{lstlisting}
\end{document}
That is how it should look:
Highlight the background behind the keywords wouldn't be that necessary but a nice gimmick.
An problem what I don't understand is how should Latex handle this case:
\begin{lstlisting}[language=Ini]
[test]
a=1
\end{lstlisting}
How can latex difference between the property and the content?