latex

Source code listing something like the pragmatic programmer books with LaTeX?

When I read Pragmatic Bookshelf's books, it has the following format How can I do that with LaTeX? Line numbers at the left side, coloring source code, and grayed source name. What's the tools for source code listing with LaTeX? Added Following Thomas' answer, I get this result. ...

new lines in displaymath Latex

hi all i need to write the next formula in latex, but i can't put it in multiple lines and with the right indentation for the subsequent lines, this is my code. \begin{displaymath} \pi_D^B(r) = \{z^{(|D|+1)}|\exists x \in r(z[D]=x[D])\wedge \\ \forall y \in r (y[D]=z[D]\Rightarrow y[T]\subseteq z[T])\wedge \\ \...

Coloring the verbatim like environment?

This is a screen capture from Pragmatic Bookshelf book. It looks like that the verbatim environment with the coloring, but I'm not sure. How can one can use color for verbatim like environment as is shown? Using line by line method would be a solution, but I expect a better way to go. {\color{red}\begin{verbatim} line 1 line...

Unable to declare a latex environment.

I tried using this code \newenvironment{bashcommands}{\ttfamily\color[RGB]{22,22,22}\begin{Verbatim}}{\end{Verbatim}} But ended up spitting out an error. The error however was not related to this command, but related to another command that I put earlier. I have verified that command to be correct on this site. This is the error I ge...

Make 1 column from two column environment with LaTeX.

I make a document with twocolumn, but sometimes twocolumn is too narrow for source code listing. I found the multicols environment and used it as follows: % \documentclass[twocolumn]{article} % I don't use towcolumn, but multicolumn \documentclass[]{article} \usepackage{multicol} ... \begin{multicols*}{2} \section{In short} ... \end{...

AucTeX/emacs problem with '$' character.

AucTeX on emacs is pretty amazing tool, but when I write one single '$', all the coloring is broken. Normally one '$' is accompanied by another '$' to express math equations, but for source listing single '$' is frequently used. \begin{Verbatim} (let ((buffer (url-retrieve-synchronously ... (re-search-forward "^$" nil 'move) <-- ...

Grayed listing environment with LaTeX

Form this LaTeX-workshop, I found I could make this listing style. by defining a new environment. \definecolor{mittelgrau}{gray}{0.85}% \lstdefinestyle{StyleCommand}{% style=StyleListingBasic, backgroundcolor=\color{mittelgrau}, prebreak=\mbox{\textbackslash{}}% } \lstnewenvironment{bevel}[1][1] {\lstset{style=StyleCommand,linewidt...

Font for programming source code with LaTeX

Listing style is normally used for source code listing, but to me the default font used is not so pretty for source code listing. Attached is a comparison between listing and verbatim. How can I use the font for verbatim when I use listing environment? What would be a good font for source code listing? ...

Solution of problems in the end of a book

I'm writing a book and want to add some math problems and solutions to this book. Is it possible to have the following in LaTeX? In the LaTeX source file, the source of the solution will be directly after the problem. In the typeset book, the section with solutions will be typeset at the end. ...

Latex Remove Spaces Between Items in List

What is the best way to format a list as to remove the spaces between list items. ...

Modifying \section{} to make it colorful with LaTeX

How can I change the \section{} style? Especially I want to change the color of section heading. I happen to find some neat style following Edward R. Tufte (http://code.google.com/p/tufte-latex/), and I'm trying to find a way to modify the section color. Added color package works fine, but the thing is that the color chapter number ...

Graying out texts with/without lines with LaTeX?

This is a screen capture from Pragmatic Bookshelf. How to make this boxed text with LaTeX? It has it's own heading with underline, and uses color. And how to make some text with gray background as follows? Added Konrad's method works, but it looks like that it doesn't work well with multicolumn package. Tonio's method shows the...

\textwidth for multicolumn document in LaTeX?

As this SO Q & A shows, I found that the \textwidth seems confusing. It's the width of text in normal case, but this variable doesn't seem to have the correct info about the width of text with multicols. This is a LaTeX code to print out the width of \textwidth (I copied the code from here). \documentclass[]{article} \usepackage{la...

Remove spacing before \chapter in LaTeX

I am using the book style to write a research report and would like to know how to remove the top vertical space before a chapter heading. I need this for the 'Abstract' page. I would like it to start nearer to the top than standard chapters. ...

Latex: Header and section titles with background.

I want to make a latex template similar to this: http://img826.imageshack.us/img826/9599/cat.png Header and section title has a grey background. How can I do that? ...

Environment inside a longtable with LaTeX

Hello, I would like to create a new environment to print a header and a footer between sections of a table. I did this: \documentclass{article} \usepackage{longtable} \newenvironment{env}{Heading&&& \\}{\hline \\} \begin{document} \begin{longtable}{p{7cm}lrr} \begin{env} Content&b&c&d \end{env} \end{longtable} \en...

Escaping spaces when calling (buffer-file-name) in emacs

So, I had a question about getting word count to work properly in emacs LaTeX mode (auctex, actually, but never mind.) That was answered fine. Then I found I had trouble when the (buffer-file-name) included spaces. This made it mess up. This problem was got around too. Now the problem is that the solution breaks when there AREN'T any spa...

Correct way to define macros \etc \ie in latex

In this article the author discusses the use of \@ to put correct spacings after full stops that are not at the end of a sentence e.g. Mr. i.e. etc. The macro suggested \newcommand\etc{etc\@ifnextchar.{}{.\@}} is not quite perfect since in the case (\etc more text) it produces (etc.more text). I have seen a lot of authors who have...

Is there a javascript LaTeX equation renderer?

I am looking for a purely client side javascript library that renders latex equations as HTML/CSS. I hate that all I see are utilities that request an image from a server. Example usage: latex('\frac{a}{b}') output: <div style="position: relative; display: inline-block; height: 2em; width: 1em"> <div style="position: absolute; top...

Latex - how to double space a caption but single space the table.

How would one double space a caption, but single space a table? ...