I defined a syntax highlighting for my code like so: \lstdefinelanguage{CSharp}{     sensitive = true,     keywords={assembly, class, method, field},     keywords=[2]{public, private, family, assembly, famandassem, famorassem, nested, static, abstract, virtual, hidebysig, cil, managed, specialname, rtspecialname, interface, sealed, auto, ansi, unicode, beforefieldinit, sequential, explicit},     keywords=[3]{class, void, string, int, object, if, else, if, switch, break, case, boo, while, truel},     keywordstyle=\color{forestgreen},     keywordstyle=[2]\color{purple},     keywordstyle=[3]\color{blue},     numbers=left,     numberstyle=\scriptsize,     stepnumber=1,     numbersep=8pt,     xleftmargin=2em,     framexleftmargin=1.5em,     showstringspaces=false,     breaklines=true,     frame=single,     basicstyle=\ttfamily,     comment=[l]{//},     morecomment=[s]{/*}{*/},     commentstyle=\color{forestgreen},     stringstyle=\color{maroon},     morestring=[b]',     morestring=[b]&quot; }  \definecolor{forestgreen}{rgb}{0.13, 0.55, 0.13} \definecolor{maroon}{rgb}{0.5, 0.0, 0.0}  \newcommand{\sourcecode}[3]{\vspace{10pt}\lstinputlisting[language=CSharp, label={#2}, caption={#3}, captionpos=b, abovecaptionskip=10pt]{#1}}  It works nicely but I can't change the colors of numbers in the code. When I add them to the keyword list they are simply ignored. And modifying the numberstyle only affects the line numbers but not the numbers in the code:  How can I set custom color highlighting for numbers in the code, such as the 0 and the 3?
I'm trying to typeset some python code, and I would like integer literals to be highlighted. I've come up, after about two hours of fighting with the documentation and various other questions here and on SO, with the following:  \lstset{ %     language=Python,     otherkeywords={1, 2, 3, 4, 5, 6, 7, 8, 9, 0},     morekeywords=[2]{1, 2, 3, 4, 5, 6, 7, 8, 9, 0},     keywordstyle=[2]{\color{orange}},     keywordstyle=\color{blue}\bfseries,     stringstyle=\color{red}, }   Unfortunately, that doesn't work. Numbers found in strings are also highlighted, which is rather annoying, and not only are they highlighted: they are highlighted in blue. Numerals in regular program text, on the other hand, are rightly highlighted in red.  Help?  EDIT: Thanks Peter Grill for your very nice solution. Is there a way to not break string colouring, though? When I use you code, the stringstyle=\color{red} doesn't seem to work anymore (strings are just plain black). Similarly, comments can be enclosed in triple quotes in python, and if I adapt your quote to detect """ blocks, then the corresponding  comments are not highlighted anymore.
How to use \def to redefine \end{split}? When I use \def to redefine \end{split}, there is an error.  \documentclass{article} \usepackage{amsmath}  \begin{document} \def\be{\begin{equation}} \def\ee{\end{equation}} \def\bs{\begin{split}} \def\es{\end{split}}  \be     \bs         a\\         b     \es \ee  \end{document}   The error is:      Runaway argument?      a\ b \es \ee       ! Paragraph ended before \split was complete.   However, if I don't use \def\es{\end{split}} and just modify the code to be  \documentclass{article} \usepackage{amsmath}  \begin{document} \def\be{\begin{equation}} \def\ee{\end{equation}} \def\bs{\begin{split}} \def\es{\end{split}}  \be     \bs         a\\         b     \end{split} \ee  \end{document}   it's OK. What's the problem? Thank you! There is an experimental timeline view for questions now available on meta ONLY! (Now working on SO, SF, and SU as well)  This is partially motivated by comments about how difficult it is to follow very active questions which have a lot of activity, and also the feedback on the API which was heavily dominated by "we need to know what happened in this time range" type responses.  It can only be accessed through URL hackery at the moment. To get to it, enter question URLs like so:  https://meta.stackexchange.com/posts/{id}/timeline  This is a chronological timeline of everything that happened on a question, including   initial question ask answers  revisions comments closure, deletion, reopen, undelete, etc votes   all based on when they happened in chronological order.  We are thinking about making this a fourth tab on the question, like so:  Timeline | Oldest | Newest | Votes  Please try it out and provide feedback. It is still a little rough, so we are not looking for highly detailed bug reports, just more general feedback.  Timeline view for this question: Updating global js variable within function and sending updated to HTML document How do I know which edition of Dungeons and Dragons (D&D) the books I'm looking at are for? , each of which has loads of rules, source, and splat books.  But how do I know which edition the books I'm looking at are for?  A lot of the time the ones in hobby stores are wrapped up, or you'll buy from elsewhere that doesn't say in the description, and the covers just say D&amp;D.  Is there a way to identify which edition of D&amp;D the books I'm buying are for, either from the cover or some description in the book?  For the purposes of this question I'm asking about core rule books only. Eg. PHB, MM, and DMG. Hopefully the answer to this can be carried over to other books. I am currently writing my bachelor thesis and I am using LyX as my standard writing program (because I am not familiar with LaTeX at all).  For my bibliographystyle I use JabRef and the citation style needs to be Journal of Finance.  Now, I found this .bst file for the Journal of Finance style online () which is actually really good. But the problem is, that I need it in German. There must be an "und" instead of "and" and all the umlauts don't work as well. Basically I need everything in German.  Do you know a website with a German .bst file? Or can I change something in the settings in LyX or JabRef and everything would be fixed? Why do some lenses focus past infinity? On the kit 18-55 lens that came with my Nikon D5100 I have noticed that when trying to focus on infinity for shots in dark conditions (star-trails, etc) the lens tends to move past infinity out of focus and need to be brought back a little to get a clear infinity focus point.  Is there a good trick for getting a clear infinity focus when in pitch dark conditions? Cookie path and its accessibility to subfolder pages Expected maximum of sub-Gaussian I'm trying to answer the following question from the book :  Let $X_1,X_2,\dots$ be a sequence of sub-gaussian random variables, which are not necessarily independent. Show that   $E\bigg[ \max_i \frac{|X_i|}{\sqrt{1 + \log i}} \bigg] \le CK$,  where $K = \max_i \|X_i\|_{\psi_2}$. Deduce that for ever $N \ge 2$ we have   $E\bigg[ \max_{i \le N} |X_i| \bigg] \le CK \sqrt{\log N}$.  I've tried to figure out what is the distribution of the maximum of Gaussians, but I'm reaching only inequalities that that don't help me answer the question.   I've also seen a similar question .  Does anyone have a clue or something to start with in order to answer this question?  Thanks! I'm looking for a specific scifi book that I read years ago, I only partially remember the story, and I don't remember the author or the title.  What I remember of the story is:   An alien race picks up a signal from humans that includes instructions on how to make their own humans (genetic instructions). The humans grow up knowing they are created and are taught by the alien race. They are eventually given resources to build a ship, and go looking for their origins. They eventually find the solar system, but nobody answers. They find some stations orbiting earth and find that the station is very old, so old in fact that humans have long been extinct and other creatures have reached local space, and have been looking around the station as an archeological dig. I think they refer to two developed races from earth, but one developed from rats.   If anyone know what story this is, and can point me at it, its been driving me crazy for at least 15 years, and I think it's actually been much longer, since I can't remember when I read it. Seeking appropriate statistic to measure spatial autocorrelation of points with binary values I am trying to determine the level of spatial autocorrelation in a point dataset.  The attribute I'm interested in is binary (presence/absence of a species), for which Moran's I is not appropriate.  On the other hand, Joint Count statistics, which are typically recommended for binary or categorical data, apparently are not appropriate for point data. What is an appropriate statistic to measure global and/or local spatial autocorrelation of points when the attribute of interest is binary? Keeping chunks loaded in minecraft I have built an iron farm somewhere far away from my actual spawn chunks in my single player world. In hindsight, this was a dumb idea, but I can't exactly change it anymore. I'd like to keep the thing running all the time, so I'm looking for a way to keep the chunks loaded.  I'm running minecraft 1.12.1, is it possible at the moment? I have looked at some chunk loader mods, but chicken chunk loader hasn't been updated yet, and the others simply didn't work.  I have tried moving the spawn chunks, but that hasn't done anything either.  Edit: I have worked this out with IronAnvil, and it ended up being a render setting in optifine which didn't load them correctly somehow. It has been working fine after I reset my optifine settings to default. Find Documents in MongoDB whose with an array field is a subset of a query array How can I change the language of the QGIS Interface? I want the QGIS interface in English, in order to share information with the GIS community. Using another language, when chatting with the GIS community, makes things more difficult. When I installed QGIS, it automatically set the language to French. It's very frustrating not having the opportunity to select my preferred language.   I am using Windows XP in French, but I want QGIS in English. Ksplice is an amazing software (or whatever it is). It changes the way kernel updates work: Instead of rebooting after an update, it patches memory, so you don't need to do anything. VirtualBox - how to increase video memory? Why does the jquery change event not trigger when I set the value of a select using val()? How can I pad an integer with zeros on the left? How do you left pad an int with zeros when converting to a String in java?  I'm basically looking to pad out integers up to 9999 with leading zeros (e.g. 1 = 0001). What does the |= operator do in Java? Why is accuracy not the best measure for assessing classification models? How many throws of a die until every possible result is obtained? A die is thrown until every possible result (i.e., every integer from 1 to 6) is obtained. Find the expected value of the number of throws.   How do I do that? I understand that probability for the single result is $\{1, 5/6, \ldots , 1/6\}$, but what about the expected value?