Does anybody know how to set the packages "listings" and "pythonhighlight" for displaying one blank space before (this already works) and after an "=" (and maybe other operation-symbols for future usage)?
I have an appendix section as .tex file:
\subsection{DALAtomObjectService}
\label{app:DALAtomObjectService} % chktex 24
Beispiel für die ``Object\_Service\_Atom''-Klasse im Data-Access-Layer (Ausschnitt):
\begin{python}
class Object_Service_Atom(Object_Service_Abstract):
def __init__(self):
self.url = ATOM_BINDING_URL
def createDocument(self, repositoryId, properties, **kwargs):
service = inspect.stack()[0][3]
kwargs['service'] = service
url = self.url + "/" + repositoryId + "/children"
data = Atom_Properties_Post(
properties['name'], properties['objectTypeId']).getAtomProperty()
params = {}
if 'folderId' in kwargs:
params['id'] = kwargs['folderId']
create_response = RS().post(url, params=params, data=data, **kwargs)
return create_response
\end{python}
This is displayed in the created PDF like this:
1 class Object_Service_Atom(Object_Service_Abstract):
2
3 def __init__(self):
4 self.url =ATOM_BINDING_URL
5
6 def createDocument(self, repositoryId, properties, **kwargs):
7 service =inspect.stack()[0][3]
8 kwargs[’service’] =service
9 url =self.url +"/" + repositoryId +"/children"
10 data =Atom_Properties_Post(
11 properties[’name’], properties[’objectTypeId’]).getAtomProperty()
12 params ={}
13 if ’folderId’ in kwargs:
14 params[’id’] =kwargs[’folderId’]
15 create_response =RS().post(url, params=params, data=data, **kwargs)
16 return create_response```
But I don't want the assignments like
self.url =ATOM_BINDING_URL
but simply like that:
self.url = ATOM_BINDING_URL
.
In the Packages.tex file in the Section "Allgemein" (General) I have the following settings for the "listings" and "pythonhighlight" packages:
% zum Einbinden von Programmcode -----------------------------------------------
\usepackage[utf8]{inputenc}
\usepackage{listings}
\usepackage{pythonhighlight}
\usepackage{xcolor}
\definecolor{hellgelb}{rgb}{1,1,0.9}
\definecolor{colKeys}{rgb}{0,0,1}
\definecolor{colIdentifier}{rgb}{0,0,0}
\definecolor{colComments}{rgb}{0,0.5,0}
\definecolor{colString}{rgb}{1,0,0}
\lstset{
float=hbp,
basicstyle=\footnotesize,
identifierstyle=\color{colIdentifier},
keywordstyle=\color{colKeys},
stringstyle=\color{colString},
commentstyle=\color{colComments},
backgroundcolor=\color{hellgelb},
columns=flexible,
tabsize=2,
frame=single,
extendedchars=true,
showspaces=false,
showstringspaces=false,
numbers=left,
numberstyle=\tiny,
breaklines=true,
breakautoindent=true,
captionpos=b,
showstringspaces=false
}
\lstdefinelanguage{cs}{
sensitive=false,
morecomment=[l]{//},
morecomment=[s]{/*}{*/},
morestring=[b]", % chktex 18
morekeywords={
abstract,event,new,struct,as,explicit,null,switch
base,extern,object,this,bool,false,operator,throw,
break,finally,out,true,byte,fixed,override,try,
case,float,params,typeof,catch,for,private,uint,
char,foreach,protected,ulong,checked,goto,public,unchecked,
class,if,readonly,unsafe,const,implicit,ref,ushort,
continue,in,return,using,decimal,int,sbyte,virtual,
default,interface,sealed,volatile,delegate,internal,short,void,
do,is,sizeof,while,double,lock,stackalloc,
else,long,static,enum,namespace,string},
}
\lstdefinelanguage{natural}{
sensitive=false,
morecomment=[l]{/*},
morestring=[b]", % chktex 18
morestring=[b]',
alsodigit={-,*},
morekeywords={
DEFINE,DATA,LOCAL,END-DEFINE,WRITE,CALLNAT,PARAMETER,USING,
IF,NOT,END-IF,ON,*ERROR-NR,ERROR,END-ERROR,ESCAPE,ROUTINE,
PERFORM,SUBROUTINE,END-SUBROUTINE,CONST,END-FOR,END,FOR,RESIZE,
ARRAY,TO,BY,VALUE,RESET,COMPRESS,INTO,EQ},
}
\lstdefinelanguage{php}{
sensitive=false,
morecomment=[l]{/*},
morestring=[b]", % chktex 18
morestring=[b]',
alsodigit={-,*},
morekeywords={
abstract,and,array,as,break,case,catch,cfunction,class,clone,const,
continue,declare,default,do,else,elseif,enddeclare,endfor,endforeach,
endif,endswitch,endwhile,extends,final,for,foreach,function,global,
goto,if,implements,interface,instanceof,namespace,new,old_function,or,
private,protected,public,static,switch,throw,try,use,var,while,xor
die,echo,empty,exit,eval,include,include_once,isset,list,require,
require_once,return,print,unset},
}
\lstset{language=python,texcl=true}
\lstset{literate=
{á}{{\'a}}1 {é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1 {ú}{{\'u}}1 % chktex 7
{Á}{{\'A}}1 {É}{{\'E}}1 {Í}{{\'I}}1 {Ó}{{\'O}}1 {Ú}{{\'U}}1
{à}{{\`a}}1 {è}{{\`e}}1 {ì}{{\`i}}1 {ò}{{\`o}}1 {ù}{{\`u}}1 % chktex 7
{À}{{\`A}}1 {È}{{\'E}}1 {Ì}{{\`I}}1 {Ò}{{\`O}}1 {Ù}{{\`U}}1
{ä}{{\"a}}1 {ë}{{\"e}}1 {ï}{{\"i}}1 {ö}{{\"o}}1 {ü}{{\"u}}1 % chktex 7
{Ä}{{\"A}}1 {Ë}{{\"E}}1 {Ï}{{\"I}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1
{â}{{\^a}}1 {ê}{{\^e}}1 {î}{{\^i}}1 {ô}{{\^o}}1 {û}{{\^u}}1 % chktex 7
{Â}{{\^A}}1 {Ê}{{\^E}}1 {Î}{{\^I}}1 {Ô}{{\^O}}1 {Û}{{\^U}}1
{œ}{{\oe}}1 {Œ}{{\OE}}1 {æ}{{\ae}}1 {Æ}{{\AE}}1 {ß}{{\ss}}1
{ç}{{\c c}}1 {Ç}{{\c C}}1 {ø}{{\o}}1 {å}{{\r a}}1 {Å}{{\r A}}1
{€}{{\EUR}}1 {£}{{\pounds}}1
}
I'm using a template, only the two last "\lsets" and the "showstringspaces=false" were later added by me.
There is probably a simple solution, but I have not yet managed to find something with Google that corresponds to what I want. LaTeX is new to me, otherwise I might be able to search more purposefully.
Thanks for help with examples or hints where to look!