Tagged Questions

The tag has no wiki summary.

learn more… | top users | synonyms

9
votes
2answers
6k views

Code Snippet IN Text

How do I show a code snippet directly in my text? I dont want to have an extra box for it like lstlisting or verbatim provide it. My example may should look like this: The class List.class is... ...
8
votes
2answers
3k views

Which package to use for writing algorithms?

I am looking for a package that will allow me to write pseudocode of algorithms. The pseudocode may include mathematical symbols, like \forall, \in and subscripts. But I would like also to "talk" ...
7
votes
3answers
1k views

How to properly display backticks in verbatim environment?

I am preparing a beamer presentation where I need to display some markdown code involving backticks. Specifically, I want to show backticks in the verbatim environment. However, LaTeX renders them as ...
4
votes
2answers
860 views

minted doesn't escape LaTeX code inside python docstring

How can I get minted to escape LaTeX code inside docstrings? Should I use some switch? \documentclass[a4paper,12pt]{article} \usepackage[italian]{babel} \usepackage[T1]{fontenc} ...
1
vote
0answers
55 views

How can i write the code of Pascal's triangle? [duplicate]

Possible Duplicate: Pascal's triangle in tikz How can i write the code of Pascal's triangle? Pleae help me.Thank you.
3
votes
1answer
349 views

Highlighting changes in code

I want to print code, preferably syntax highlighted, and then combine this with a diff where the included code is the newer version of the code. I want lines that have been added or changed to be ...
3
votes
1answer
530 views

New line in code with no white space in output?

I would like to put my \footnotes{} on a separate line in code, to make code easier to maintain and read. But I don't want any whitespace in between the foot note, and the preceeding word in the ...
23
votes
1answer
9k views

How to properly code a TeX file, or at least avoid `badness 10000`

I'm coding a TeX file and although the .pdf is correctly rendered, I'm using "stone age" tools to code it. As some examples, I use \\ to leave a line space between two paragraphs, or \noindent in ...
6
votes
5answers
8k views

Verbatim environment with correct tab handling and special characters

I'm looking for an environment similar to Verbatim which will allow me to say something like the following code (which uses indentation instead of spaces): \documentclass{article} ...
10
votes
1answer
832 views

Code readability

I'm getting my head around LaTeX, and I find really awesome the fact that the documents are completely editable with a plain text editor, while getting a really neat and professional output. I'm ...
7
votes
1answer
1k views

How do I get colorized syntax highlighted code in pdfLaTeX

I'd like to get syntax highlighted code in LaTeX, but want to preserve the monospaced font (no curly quotes either). pygments doesn't seem to have an option to avoid curly quotes that I could find. ...
4
votes
1answer
2k views

Color \ , [], {} and / in listings environment

I tried to color a source code listing as follows. I would like the \ to be the same color as the word that follows for example: \documentclass in red including "\" \usepackage in blue including "\" ...
4
votes
1answer
118 views

Style when mixing arguments/methods from a computer program with text and math

I'm working on a document that is a cross of user's guide and a technical manual. I describe a system which has variables that I handle normally, then introduce an R package that I've written which ...
5
votes
2answers
400 views

Aligned, hanging indents in non-monospaced code

I want to typeset a piece of code containing line breaks. New lines should indent to a specified point in the previous line. Here is a monospaced example to illustrate what I mean. Notice how ...
5
votes
1answer
2k views

Environment code undefined

Why do I get ! LaTeX Error: Environment code undefined. when I use: \documentclass[10pt,a4wide]{article} \usepackage{a4wide} \usepackage[utf8]{inputenc} \usepackage[portuguese]{babel} ...
56
votes
3answers
3k views

Are there any coding style guidelines for LaTeX?

I have been using LaTeX for a long time now, but still all my document files look a bit messy. Now I want to get rid of this bad habit and get some order into my code. That is why I am wondering ...
1
vote
0answers
114 views

Print programs with its proper syntax by minted [closed]

I have post a question several weeks ago: Print programs with its proper syntax, and I finally decided to use the package minted. I summarize a little bit my needs here: the language I define has its ...
2
votes
1answer
334 views

Force minted to insert new space in code that won't fit on the page

Essentially I would like to have listings' breaklines option on minted. I can't seem to find it. I could manually insert new lines but it becomes difficult when the code comes from an external file.
8
votes
2answers
2k views

How to make a single word look as some code?

I would like to be able to make a single word in a text look like a coded word. Is there any command such as \code{...} which allows me to do so? (basically, I want to produce something like above ...
2
votes
1answer
1k views

LaTeX/Packages/Listings and subindex

I am using LaTeX/Packages/Listings AND this code to make a rectangle with sql source code inside of it, but I would like to have the option to insert subindexes... I try it using the following but ...
1
vote
1answer
243 views

Print programs with automatically generated line numbers and tabbing

I have post a question several weeks ago: Print programs with its proper syntax, and I choose to use tabbing package at the moment. Now I really need to keep the tabbing and print a line number ...
2
votes
2answers
1k views

input filename as caption in listing

I'm working on the following piece of code \newcommand{\mycin}[1]{% new command for icluding piece of code from external files \lstinputlisting{#1} } I want to add a caption that reflects the ...
1
vote
1answer
408 views

Listings settings for command line arguments [closed]

I am typesetting a set of instructions which includes several (Unix) command line arguments. I have been using the listings package to include these arguments, but the colouring is less than ideal. ...
5
votes
1answer
3k views

Fortran syntax highlighting in listings

I've got some Fortran 90 source code I want to put into my thesis appendix. For this I'm using the listings package. Is it possible to have colored syntax highlighting for the Fortran code?
16
votes
4answers
686 views

Is this branching code I wrote a bit obfuscated?

I've been away for a while and I forget if this sort of question is appropriate, but here goes. Recently I wrote some code (in expl3 but I hope it's clear enough) and in hindsight I wonder on its ...
5
votes
2answers
2k views

How to pass definitions to \AtBeginDocument?

I need to delay execution of a chuk of code to the time when other packages are loaded so I wrap it into \AtBeginDocument: \AtBeginDocument{% \def\reserved@a#1#2{% \edef\reserved@b{#1}% ...
3
votes
1answer
242 views

Extracting parts of a .sty file

Can you load only some specific parts from a package while not loading the rest at all? For example, from the code below I wanted to load only the \newcommands %theorems \usepackage{theorem} ...
1
vote
0answers
102 views

What is the simpliest way to make a documentation from code [duplicate]

Possible Duplicate: How best to include programming source code in LaTeX documents? suppose a file with code (*.cpp, *.php, or whatever). There's a lot of symbols like '$', '{', '}' what ...
6
votes
2answers
5k views

Is there a way to enable syntax highlighting coloring in Lyx for program listings?

I want to embed a small program listing and have used Insert -> Program Listing in LyX's menu for that. The settings dialog supports selecting a language (Java), but I can't actually see any ...
6
votes
5answers
5k views

Aligning pseudocode in LaTeX

My algorithms class is following strict guidelines for pseudocode. Let's say I have something like the following: y = 0 for i = n downto 0 y = a_i + x * y I want this to appear left-aligned on ...
33
votes
3answers
4k views

LaTeX code sniffer and/or beautifier?

I'm looking for a LaTeX code sniffer and/or code beautifier, because I'm creating a CI server for my LaTeX books and I wanted a few things. :D
21
votes
2answers
1k views

Print programs with its proper syntax

I have defined my own language whose syntax is very close to the one of Pascal. I would like to type the following program for instance. Many people use the packages algorithmicx or algorithm2e to ...
2
votes
0answers
156 views

Source code line numbers in PDF [duplicate]

Possible Duplicate: Extended draft mode which includes source information for manual print-out to source synchronisation I am writing a document in LaTeX which I compile to PDF, which I ...
2
votes
4answers
752 views

How to place a program and a text side by side?

My first question is how you write a program in LaTeX, with and without a line number for each line. The second question is, because often my program is not too large, I want to save some space for ...
7
votes
2answers
3k views

How to typeset VBA code in LaTeX?

I have a lot of VBA (Visual Basic for Applications, the programming language in Microsoft Office) code which I have to add to my thesis in the appendix. I wonder how I can most comfortably list those ...
3
votes
3answers
891 views

Right justify inline

I am trying to right justify some code as a text wrap for a memo on the C language and I encountered some issues... In the following exemple I'm trying to right justify the "const struct tm *ptm);" ...
19
votes
2answers
14k views

How to format an inline source code

I have a document where I quiet often refer to source code element, such as class names, I wanted to format these strings differently, but at the beginning I didn't want to fiddle with various options ...
4
votes
1answer
156 views

Code inside an equation environment is executed 4 times (or isn't it?).

I created a small example: \documentclass[a4paper,12pt]{article} \usepackage{amsmath} \usepackage[pdfstartview=FitH]{hyperref} \usepackage{bookmark} \begin{document} one line \newcounter{test} ...
4
votes
1answer
484 views

Columns with Latex code and Output in a Beamer presentation

I am new to Latex and am working on a small presentation using Latex and Beamer. In one frame, I'm trying to show some Latex code and it's output. Initially I just took a screenshot of the Gummi tex ...
6
votes
1answer
383 views

Hyphenation of long Java identifiers

What is the best practice for hyphenating long identifiers like Character.isJavaIdentifierStart when they appear in body text? I am aware of the path package that also deals with otherwise active ...
4
votes
1answer
745 views

How can I input part of a file in verbatim?

I'm writing the documentation to a large piece of Matlab code. I would like include tags in my Matlab code and then read the lines of code between the tags into Latex and output them as verbatim (or ...
3
votes
1answer
254 views

The source code for accent commands

I'm using LaTeX on Ubuntu, it calls TeX Live here. I'm interested to see source code of accent commands behavior. Where can I find it?
4
votes
1answer
734 views

\fbox inside listings

I am trying to highlight a specific line inside a listing with listinline. The code I am currently using looks like this: \begin{lstlisting}[escapechar=!] class A { void m() { B b = ... ...
6
votes
1answer
827 views

Problem about program code included in LaTeX

I have some Matlab code which I would like to include in my LaTeX document. I use fancyvrb package, based on which I define a new environment called code. An complete and minimum example is: ...
20
votes
2answers
3k views

Code spanning over two pages with minted, inside listing with caption

I am trying using minted to display some code in my document, but the code is long and spans over two pages, this works fine, however when I place my code inside \begin{listing} ...
7
votes
1answer
663 views

visualize code indentation

How can I visualize code indentation? What I want is to draw a vertical line along the indentation. Since an example is easier to show then to explain you can see one in this paper (on page 2)
3
votes
1answer
205 views

Shrink code chunks in a documentation

i'm making a documentation of a system, and i have a lot of code chunks that i want to explain, but some of them are too long. My questions if there are some way to automatically shrink those too big ...
4
votes
1answer
247 views

Cg Code in Latex

I am writing some document which contains Cg (C for Graphics) code in the document. I want to show the code in a neat highlighted mode. Any easy method to suggest? I tried the listings package but it ...