EnglishFrenchSpanish

OnWorks favicon

lgrind - Online in the Cloud

Run lgrind in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command lgrind that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

PROGRAM:

NAME


lgrind - grind nice program listings using LaTeX

NOTE


This man page is not yet much outdated, but might be soon except somebody asks me to work
on it. Consider the LaTeX docs the real docs.

SYNOPSIS


lgrind [ -e ] [ -i ] [ - ] [ -n ] [ -c ] [ -t <width> ] [ -h <header> ] [ -d <description
file> ] [ -l<language> ] [ -s ] <name> ...

DESCRIPTION


LGrind formats program sources in a nice style using LaTeX(1). Comments are placed in
roman, keywords in bold face, variables in italics, and strings in typewriter font. Source
file line numbers appear in the right margin (every 10 lines).

LGrind processes its input file(s) and writes the result to standard output. This output
can be saved for later editting, inclusion in a larger document, etc.

The options are:

-e process a LaTeX file for embedded code.

-i process source code file for inclusion in a LaTeX document.

- take input from standard input.

-n don't boldface keywords.

-c don't treat @, etc. specially in comments.

-t change tab width (default 8).

-h specifies text to go into the header.

-d specifies the language definitions file (default is
/usr/lib/texmf/tex/latex/lgrind/lgrindef).

-d! same as above, but write patched executable.

-l specifies the language to use.

-s shows a list of currently known languages.

If LGrind is called without parameters, a help screen will be shown. If neither -e nor -i
are specified, a complete LaTeX file is produced. When no language is specified, LGrind
tries to find out the language used itself; C is used when this fails.

USAGE


For example, to include a C file named foo.c into your LaTeX document, first give the
command:

lgrind -i -lc foo.c > foo.tex

This will generate foo.tex, which will have the pretty-printed version of foo.c with a lot
of LaTeX commands.

Then include lgrind.sty as you include any other style, namely with the
\usepackage{lgrind} line at the beginning of your LaTeX document. Having done this, within
the document you can include foo.tex using one of the following commands:

\lgrindfile{foo.tex}
which will simply include the file at that point of text, and will draw horizontal
lines before and after the listing.

\lagrind[htbp]{foo.tex}{caption}{label}
which will put the listing also within a figure environment, using the float
options, caption and label you gave.

To produce a standalone LaTeX file from, say, a Yacc file:

lgrind -ly bary.y > bary.tex
This uses Piet van Oostrum's fancyhdr.sty to make the headers and footers.

For a more detailed explanation of these commands, refer to
/usr/TeX/texmf/doc/latex/lgrind.dvi.

EMBEDDED PROGRAMS WITHIN A LaTeX FILE


(From Jerry Leichter's notes.)

Within the text of your LaTeX file, you mark groups of lines as either text- or display-
style program code:

Text style:

The expression
%(
a + 3
%)
produces 10.
prints something like: "The expression a + 3 produces 10." (with "a + 3" set as a
program.)

The same effect can be achieved with inline @'s.

The expression @a + 3@ produces 10.

Display style:

The statement
%[
a += 3;
%]
is an example of an incrementing operator.
prints something like:

The statement
a += 3;
is an example of an incrementing operator.

Important rules:

% and the following character must be the first two characters on the line to be
recognized.

Put nothing on the line after the % and the key character. If you do that, LGrind
will provide a default environment that will produce an \hbox for %( )%, and a
\vbox for %[ - %]. If you put stuff on the line, LGrind assumes you want to
control the format completely. Doing this requires understanding exactly what the
code LGrind produces is doing. (Sometimes I'm not sure I do!)

%) and %] are, if I remember right, simply ignored outside of a code group, but any
extra %( or %[ produces a warning, so a missing %) or %] is usually caught.

You can insert your own code by using a line starting with %= in the program text.
Whatever you enter after that is left in the output, exactly as you typed it. It will be
executed in a strange environment, so doing anything fancy is very tricky. A macro,
\Line, is provided to help you do simple things. For example,

%[
%=\Line{________\vdots}

a = 1;
%]
produces:

.
.
.
a = 1;

(Within the program text, _ is active and expands to a fixed-width space. A whole bunch
of macros are also defined. If you understand how LGrind sets lines up, you can replace
the 8 _'s with a call to \Tab — but I'll let you hang yourself on that one.)

The output of LGrind always contains exactly one output line for each input line. Hence,
you can look up line numbers in TeX error messages in your original file, rather than in
the lgrind'ed (lground?) file. (Of course, if the problem is in the LGrind output....)

Many things are controllable by re-defining various macros. You can change what fonts
LGrind will use for various kinds of things, how much it indents the output, whether it
adds line numbers, and if so at what interval it prints them and whether it sticks them on
the left or right, and so on. This stuff is all described in lgrind.dvi, though probably
not very well. The default settings produce output that looks reasonable to me, though I
can't say I'm ecstatic about it. Doing a really good job would require defining some
special fonts.

Use lgrind online using onworks.net services


Free Servers & Workstations

Download Windows & Linux apps

  • 1
    Psi
    Psi
    Psi is cross-platform powerful XMPP
    client designed for experienced users.
    There are builds available for MS
    Windows, GNU/Linux and macOS.. Audience:
    End Users...
    Download Psi
  • 2
    Blobby Volley 2
    Blobby Volley 2
    Official continuation of the famous
    Blobby Volley 1.x arcade game..
    Audience: End Users/Desktop. User
    interface: OpenGL, SDL. Programming
    Language: C++, Lua. C...
    Download Blobby Volley 2
  • 3
    SuiteCRM
    SuiteCRM
    SuiteCRM is the award-winning Customer
    Relationship Management (CRM)
    application brought to you by authors
    and maintainers, SalesAgility. It is the
    world�s mos...
    Download SuiteCRM
  • 4
    Poweradmin
    Poweradmin
    Poweradmin is a web-based DNS
    administration tool for PowerDNS server.
    The interface has full support for most
    of the features of PowerDNS. It has full
    support...
    Download Poweradmin
  • 5
    Gin Web Framework
    Gin Web Framework
    Gin is an incredibly fast web framework
    written in Golang that can perform up to
    40 times faster, thanks to its
    martini-like API and custom version of
    httprout...
    Download Gin Web Framework
  • 6
    CEREUS LINUX
    CEREUS LINUX
    CEREUS LINUX basado en MX LINUX con
    varios entornos de escritorios. This is
    an application that can also be fetched
    from
    https://sourceforge.net/projects/cereu...
    Download CEREUS LINUX
  • More »

Linux commands

  • 1
    abl
    abl
    abl - Prefixed representation for
    boolean functions DESCRIPTION:
    libablmmm.a is a library that enables to
    represent a boolean function in a
    LISP-like form. An ...
    Run abl
  • 2
    abook
    abook
    abook - text-based address book program
    ...
    Run abook
  • 3
    coqchk.opt
    coqchk.opt
    coqchk - The Coq Proof Checker compiled
    libraries verifier ...
    Run coqchk.opt
  • 4
    coqdep
    coqdep
    coqdep - Compute inter-module
    dependencies for Coq and Caml programs ...
    Run coqdep
  • 5
    fweb
    fweb
    ftangle,fweave - WEB processors for C,
    C++, Fortran, Ratfor, and TeX ...
    Run fweb
  • 6
    fweelin
    fweelin
    freewheeling � live looping musical
    instrument ...
    Run fweelin
  • More »

Ad