6
votes
2answers
108 views

Seemingly trivial: verbatim, newenvironment, and colorbox

I am, once again, trying to achieve what seems like a trivial goal. I want to use \newenvironment to define a verbatim environment with a background color. I need to define my own environment because ...
4
votes
1answer
36 views

Is there a way to format a diff patch block? [duplicate]

I'm trying to inline a few snippets of diff patches, and manually formatting them is a droll - is there a way to do it automatically? In general I want it to look like the following example, but ...
14
votes
2answers
336 views

Getting verbatim with soft grey background, as in tex.stackexchange

Given a verbatim as on below, \begin{verbatim} This is an awesome verbatim \end{verbatim} which is displayed with no background on the compiled pdf page : This is an awesome verbatim I would ...
3
votes
1answer
191 views

Color Text and BG of Verbatim, without affecting `fancyvrb` line numbers

The MWE below aims to color the text and background of a Verbatim environment. \documentclass{article} \usepackage{fancyvrb} \usepackage{color} \usepackage{calc} ...
4
votes
1answer
208 views

Beamercolortheme: How to set default color for all verbatim?

I want to change the color of all verbatim text in an existing beamer presentation. How do I do this easily? I know how to use colored verbatim text in general, and I found a lot of suggestions here ...
2
votes
2answers
512 views

Create a new environment that uses a verbatim environment

Consider the following: \documentclass{article} \usepackage{environ} \usepackage{verbatim} \usepackage{color} \NewEnviron{vred}{% \color{red} \begin{verbatim} \BODY \end{verbatim} } ...
4
votes
1answer
922 views

lstlisting in a box?

My problem is that I am trying to write a document with coloured sections for examples. Examples can contain code listings. Somehow I can't seem to combine a background colouring with a listing, or ...
6
votes
2answers
167 views

Highlighting code like one would in a SE post

When posting on SE, users can "highlight" code by using the ` symbol. Is there any way to get that in LaTeX? My intention is to highlight segments of code or particular functions. To be clear, I'm ...
4
votes
2answers
802 views

Set color to output from verbatim

I want to show the output from verbatim in blue color. I have this: \newcommand{\blockcode}[1]{\ttfamily\small#1} {\blockcode \begin{verbatim} alias vi="vim" \end{verbatim}} which works fine. ...
3
votes
1answer
2k views

Changing color of text snippet in a verbatim environment

Is it possible to change color of part of the text that is in a verbatim environment? Lets say I have this verbatim section. I want to change the color of the marked lines into blue. ...
5
votes
1answer
523 views

colored full width box with some verbatim text inside?

I would like to create a text box of "reminders" for my readers. I'd like the box to be gray, go full text width, and have both normal and verbatim text in it. Reminder ensure blah blah ...
5
votes
4answers
2k views

Verbatim environment with background color (PDFLaTeX and tex4ht)

I need to make a verbatim environment with gray background color, such as: That needs to work with PDFTeX and tex4ht on an older TeX installation (from 2009 I believe). My approach so far is ...
3
votes
1answer
381 views

Color box with outline but some difference

\begin{boxedlaw}{6.4in} \colorbox[HTML]{F8E0E0}{ \begin{minipage}[c]{380px} \begin{center} \begine{verbatim} \# define LM_ENCA 18 //Port0 \# define LM_ENCB 17 ...
9
votes
2answers
1k views

How to change color of some particular environment for entire document

I want to change color of particular environment in document. For example wherever I found verbatim environment or equation environment appears in my tex file. With some global settings, I want to ...
15
votes
2answers
2k views

Colored background in inline listings

I would like to make inline code more distinguishable from the text surrounding it, and I thought that using a background might work (like it is done on the stackexchange pages.) Since I use the ...
7
votes
3answers
650 views

How can I redefine the \verb|…| command?

I'd like to redefine the \verb|...| command so that it had a light-gray background and a little bit darker border around it, and a little bit of padding to make this background "box" noticable. Anyone ...
3
votes
1answer
628 views

Underlining a coloured DNA sequence

In the posts to the question of Timtico (here) several ways have been proposed to colour the As,Ts,Cs and Gs differently within a DNA sequence. What I want is also to be able to underline some ...
20
votes
5answers
943 views

typesetting different characters with different colors in a DNA sequence

I have created a macro which I used to format DNA sequences, as they should be in the monospaced font and uppercased: \newcommand{\DNA}[1]{\texttt{\uppercase{#1}}} Now I have a column with some ...
2
votes
1answer
2k views

Background color in Verbatim

I've to use the yellow background for data values in the following code. \usepackage \begin{Verbatim}[commandchars=\\\{\}] \color{blue}DATA \color{black}Heart; \color{blue}INPUT \color{black}X Y @@; ...
9
votes
2answers
1k views

How do I backcolor in verbatim?

I have some code I want to typeset as verbatim (lstlisting would be ok as well) - but I want to highlight some parts of it via a different background color, i.e. something like this: \begin{verbatim} ...