1
vote
1answer
35 views

Horizontal and vertical alignment of an element to the centre of a whole page

I am trying to place a code frame generated with listings package in the middle of a page both horizontal and vertical. How can I do it? Edit I: My code is this: \documentclass[12pt]{article} ...
5
votes
1answer
48 views

How do I maintain structure in structured output?

I am trying to ensure output from a Linux command - which looks like: Into a LaTeX document with the same column structure with the output headers lined up with the output sections on the next ...
4
votes
2answers
78 views

How to make a minted code listing centered on a page?

So, I am writing a report with Prolog code listings in it. I have been using lstlisting to make my listings and I made my code centered on the page, such as this: \renewcommand{\figurename}{Listing} ...
6
votes
1answer
54 views

Alignment problem if line breaks are used in listings

I am using a monospace font and I want that all lines are horizontally aligned ("a" should be directly under "a"). How can I do this? I have noticed that also the pagebreak symbol shifts the text. ...
3
votes
1answer
98 views

Caption package destroys center/varwidth

I have received a wonderful comment how to get listings centered: \documentclass[a4paper]{book} %\usepackage[hang,small,it,hypcap=true]{caption} % screw hypcap \usepackage[T1]{fontenc} ...
2
votes
0answers
49 views

Center a Listing [duplicate]

What is a simple way to make a lstlisting centered? Like \documentclass{article} \usepackage{verbatimbox} \usepackage[T1]{fontenc} \usepackage{fancyvrb} \usepackage{listings} \lstset{ ...
1
vote
1answer
172 views

Using lstlistings in two columns

My goal is to display source code (awk, Python, R and SAS) and text (their output) side-by-side. Both are loaded from external files, and can be pretty long sometimes (pagebreaking is inevitable), the ...
3
votes
1answer
106 views

Globally set the justification in a framed box

I want to show the text from a Python Interpreter in a Windows console. This should be plain text (like you see in a command line terminal). I also want to show Python code snippets with highlighting. ...
2
votes
1answer
238 views

Center just one line of code (e.g. comment)

In my lstlisting I want to place a comment in the form of /*====== some section ====== */ but having it centered and not like the rest of the lines of code which are left aligned. Using the escape ...
11
votes
2answers
593 views

Center caption in listing

I want to put the caption of my listing in the center but I can't do that. Do you have any idea how I could achieve this? The code: \documentclass{report} \usepackage{color} \usepackage{xcolor} ...
9
votes
1answer
2k views

How to center a lstlisting

I have the following problem. I want to center a listing, I tried this approach: How to center a listing? It works but when I try to set frame or numbers specifically for each listing I get errors. ...
2
votes
0answers
41 views

Aligning comments that break in several lines? [duplicate]

Possible Duplicate: How to align comments with lstlistings? I want to include Matlab code with long comments. The next MWE shows that it is achieved by using the listings package. However I ...
4
votes
1answer
678 views

How to center listings caption?

I would like to know how to center the listings gerenated caption in LaTeX. It always go to the left of the code. The rest of the captions (tables) are OK. \documentclass[11pt,a4paper,oneside, ...
3
votes
1answer
730 views

Problem with alignment in listings

I have a follow up question to this post I am using listings in beamer. The content in listings is being pushed further left than the other contents on my slides. I am using the code below to correct ...
7
votes
3answers
684 views

An environment for writing regular-font pseudocode

I want to create a pseudocode environment that looks like this: Basically, the font doesn't change - it's just the same as that of the surrounding text. It allows mathmode. And there is a box ...
10
votes
2answers
888 views

How to align comments with lstlistings?

I am using listings with these settings: \lstset{language=C++,basicstyle=\small\sffamily, numbers=none, frame=tb, columns=fullflexible, showstringspaces=false } I like the proportionally ...
10
votes
5answers
3k views

How can I properly align the line numbers of a source code listing with the margin?

I want to include a code snippet in a document using the listings package. In my document, I have the following: \begin{figure}[!htbp] \setlength{\fboxsep}{0pt}% \setlength{\fboxrule}{0pt}% ...
5
votes
1answer
1k views

Displaying two XML listings side by side.

I have two XML outputs from a program that I would like to include in a LaTeX document. I would like them to appear side-by-side each in its own box. So that a reader can compare the two outputs while ...
4
votes
1answer
1k views

Aligning function arguments in “algorithm” environment.

In the "algorithm" environment, when a function call spans multiple lines, I would like to have its arguments aligned, like so: MyFunction(long_arg_name0, long_arg_name1, ...
2
votes
2answers
1k views

Center a Listing on page [duplicate]

I am trying to center a listing horizontally within a page. So far I have tried defining the following macro: \lstnewenvironment{snippet}[1][] {\centering \lstset{float=htpb,#1}} {} But ...
20
votes
1answer
5k views

How to center a listing?

I'm trying to get some console output in my homework. I put it in a listings environment but I want it to be centered horizontally on the page. The only thing I get centered is the caption ;-/ ...
8
votes
2answers
4k views

How to align source code produced by listings package with main paragraph text

I'm using the latex listings package for the first time to format some HTML. I'm noticing that by default, the html code is being pushed further left than the main paragraph text of my document. Is ...