Magic Point - an X11 based Presentation Tool

转自:http://www.maths.ox.ac.uk/help/faqs/miscellaneous/magicpoint

Magic Point - an X11 based Presentation Tool

MagicPoint is an X11 based presentation tool. It is designed to make simple presentations easy while to make complicated presentations possible. Its presentation file (whose suffix is typically .mgp) is just text so that you can create presentation files quickly with your favorite editor (e.g. Emacs). Note it is only available on the Linux machines.

To see the sort of things magicpoint can do run it on the samples, e.g.

mgp /usr/share/doc/mgp/examples/sample.mgp

and

mgp /usr/share/doc/mgp//sample/tutorial.mgp

Other sample mgp files in the same directory worth looking at are gradation.mgp and multilingual.mgp.

To see how these are written simply more the file in question.

Basic usage instructions (excerts from info by Kazu Yamamoto)

All .mgp commands start with "%". Add the following line to the beginning of the .mgp file.

%include default.mgp

This determines the default style. Each page begins with "%page".

%page

TITLE

Body

MagicPoint is line oriented. Don't write anything in the first line because the default style uses the first line for making space at the top of the screen. The second line is the title of the page. The third line is transformed into a horizontal line. The fourth line on becomes the body.

When there is a "%" at the beginning of a line, the rest of the line becomes a command. Multiple commands separated by "," can be written in a single line. To make the size 7% of the screen and the foreground color yellow, one would write:

%size 7, fore yellow
This line is big and yellow.

Any line that starts with "%" won't show up on the screen nor will it be counted as a line. The following parameters can be used to change how a line looks.

text color %fore
background color %back
text size %size
text placement %center, %left, %right
space between characters %hgap
space between lines %vgap
Font %font

There are a few others, but this should be enough for now. The parameters of default.mgp are set as follows:

%default 1 leftfill, size 2, fore "white", back "black", font "thick"
%default 2 size 7, vgap 10, prefix " "
%default 3 size 2, bar "gray70", vgap 10
%default 4 size 5, fore "white", vgap 30, prefix " ", font "standard"

%default set the parameters for the line specified in the first argument to the values specified the second and later argments. In the first line, the size is 2% and in the second line the size is set to 7%. Parameters set in previous lines are valid unless overwritten. Therefore, the text in the second line will be white.

When MagicPoint shows a particular line, it first refers to the %default values. Then it refers to the values set within the body. Values of the previous line remain valid unless set otherwise.

Let's take a look at the following example:

%page
(A space of 2%)
TITLE --- size 7% color white and in thick font
(A horizontal line)
text --- size 5% white thick font
%fore yellow, size 4
text --- size 4% yellow thick font
%vfont min
text --- size 4% yellow standard font

%tab is a command that directly associates with the line. In default.mgp it is set as follows:

%tab 1 size 5, vgap 40, prefix " ", icon box green 50
%tab 2 size 4, vgap 40, prefix " ", icon arc yellow 50
%tab 3 size 3, vgap 40, prefix " ", icon delta3 white 40

When there is a singular tab at the head of the line, the values of %tab override the current values and become valid. When there are two tabs at the head of the line, %tab 2 becomes valid, when there are three tabs at the head of the line %tab 3 becomes valid and so on.

In other words,
1 tab means text size 5% and the line starts with spaces and green box icon.
2 tabs mean text size 4% and the line starts with spaces and yellow arc icon.
3 tabs mean text size 3% and the line starts with spaces and white delta icon.

By using this, it's easy to itemize. Let's take a look at an example:

%page

Emacs and friends

Emacs
19 is currently the main stream
20 has been released
Mule
2.3 is most used
Integrated to Emacs and XEmacs
XEmacs
19 is the English version
20 is the International version

To find out more about the other commands, take a look at the syntax section below

You can include EPS/GIF files into a presentation with commands of the form

%image "foobar.eps"
or
%newimage "foobar.eps"

For the differnece between these two commands see the syntax section below.

Tips for better presentation

  • Refrain from using "vfont", "xfont" and "tfont" directive directly. Use "deffont" in preamble and "font" in body instead. This should allow people to view your presentation in all the configuration of the renderer. (i.e. with/without FreeType, with/without VFlib)
  • Before the actual presentation, go through the presentation in the same configuration as "the real thing". It will make rendering faster. (For the included EPS images, pixel image will be generated and be cached). If you execute "mgp" with the "-F" option, "mgp" fetches and caches the next page so that it makes faster to visualize the next page.
  • Check/practice the connection with the VGA projector.
  • Practice your oral presentation well.

Mathematical Formulas

Using LaTeX obtain .dvi file for the expression. e.g. the following code would do:
/documentclass{slides}
/pagestyle{empty}
/thispagestyle{empty}
/begin{document}
...formula...
/end{document}

Then with dvips you can obtain .eps, e.g.

latex foo.tex ; dvips -f -E foo.dvi > foo.eps

Now simply include the .eps file into your presentation as follows:

%newimage -zoom 130 "image.eps"

The same approach can be applied to figures produced with xfig that have LaTeX on them. Note sometimes using the article class with a larger zoom value gives better vertical alignment for inline maths.

Conversion to HTML

Simply use the -D option for this, e.g.
mgp -D ~/outdir file.mgp
The directory outdir into which the html and images are put must exist first for this to work. All this does is show the pages one by one and take a screen dump at each step. This results in full size and thumbnail images and an index.html file showing the thumbnails with links to the full size images.

Conversion to PS

Simply use mgp2ps, e.g.
mgp2ps -f output.ps file.mgp

Note there is a -c option for colour output but it is only experimental.

List of all syntax

placement restriction for directives:
    .mgprc    preamble  main pages
    ---   ---   ---
%vfcap    okay    x   okay
%tfdir    okay    x   okay
%tfont0   okay    x   okay
%default  x   okay    x
%tab    x   okay    x
%deffont  x   okay    x
%include  x   okay    okay
others    x   x   okay

#
  Comment lines.

%size <size>
  <size> :: size of fonts

%fore "color"
  "color" :: color of foreground

%back "color"
  "color" :: color of background

%bgrad <xsize> <ysize> <nuncolor> <dir> <zoomflag> <colorlist...>
  <xsize> :: width of generated image(0-100%)
      0 means physical display size
  <ysize> :: height of generated image(0-100%)
      0 means physical display size
  <numcolor> :: number of colors, 0 means no reduction.
      default 256 colors(8bit)
  <dir> :: gradation direction (0-360 degree)
     0 :Top to Bottom   90 :Left to Right
    180:Bottom to Top 270 :Right to Left
      default 0
    negative value means "non-liner gradation"
  <zoomflag> :: zoom to max size
    0 nozoom, 1 zoom
      default 0
  <colorlist> :: colors in the gradation image

%left
  Left justify.

%leftfill
  Left justify, with folding long line.

%center
  Centering.

%right
  Right justify.

%shrink
  (not supported at this moment)

%lcutin
  Text will be animated (flying from the leftmost edge of the page).

%rcutin
  Text will be animated (flying from the leftmost edge of the page).

%cont
  Draw without line break.

%nodefault
  Disable effect of default directive.

%xfont "font"
%xfont "font" "registry"
  <font> :: use X11's <font> to draw characters.
  "font" is for specifying X11 XLFD, font alias name, or
  "family-weight-slant".
  "registry" is for specifying "registry-encoding".

  interpretation of "registry":
  - If none specified, "iso8859-1" is assumed.
  - If no dash inside, encoding of "*" is assumed.
    Therefore, you'll get "REGISTRY-*".
  - If there's a single dash inside, use specified value.
    Therefore, you'll get "REGISTRY-SPECIFIED".

  interpretation of "font":
  - If it has no dash inside,
    Try font alias, such as "8x5" or "a14".
    If there's no font alias matched, it should be "times" or
    something like that. In this case, try
    "-*-FONT-*-*-*-*-SIZE-*-*-*-*-*-REGISTERY-SPECIFIED".
  - If it has single dash inside, such as "times-medium":
    Try "-*-FONT-NAME-*-*-*-SIZE-*-*-*-*-*-REGISTRY-SPECIFIED".
  - If it has two dash inside, such as "times-medium-r":
    Try "-*-FONT-NAME-SPECIFIED-*-*-SIZE-*-*-*-*-*-REGISTRY-SPECIFIED".
  - Otherwise, try the specified string itself as XLFD.

  Some exercises:
  %xfont "times"
    You'll get "-*-times-*-*-*-*-SIZE-*-*-*-*-*-iso8859-1".
  %xfont "mincho" "jisx0208.1983"
    You'll get "-*-mincho-*-*-*-*-SIZE-*-*-*-*-*-jisx0208.1983-*".
  %xfont "mincho-medium-r" "jisx0208.1983"
    You'll get "-*-mincho-medium-r-*-*-SIZE-*-*-*-*-*-jisx0208.1983-*".

  NOTE: Only the following items are meaningful as "registry".
    jisx0208.1983-*
    gb2312.1980-*
    ksc5601.1987-*
    iso8859-1
    iso8859-2
    iso8859-3
    iso8859-4
  It would be nice if we can support "adobe-specific" for symbols,
  however, we have no escape sequence to designate the it...

%vfont "font"
  <font> :: use VFlib's <font> to draw Kanji characters.

%tfont "font"
  <font> :: use TrueType font <font> to draw ASCII characters.
    <font> can be full pathname, or just filename.  Use %tfdir
    for setting default font directory.

%tmfont "font"
  <font> :: use TrueType font <font> to draw Kanji characters.
    <font> can be full pathname, or just filename.

%tfont0 "font"
  <font> :: use TrueType font <font>, if none of the font specified by
    %tfont directive is found.  This is the last-resort for the
    TrueType font finding code.
    (allowed in ~/.mgprc, without "%" sign)

%bar <color> <width> <start> <length>
  <color> :: color of bar, foreground color will be used as default.
  <width> :: permill of display height. default 10.
  <start> :: start position percent of display width. default 0.
  <length> :: length percent of display width. default 100.

%image "imagefile" <numcolor> <xzoomrate> <yzoomrate> <zoomflag>
%image "imagefile" [ [<numcolor>] <screensize> ]
  "imagefile" :: name of image file
  <numcolor> :: number of colors, 0 means no reduction.
  <xzoomrate> :: height percentage against physical display or original
      size, 0 means the original height.
  <yzoomrate> :: width percentage against physical display or original
      size, 0 means the original width.
  <zoomflag> :: 0 means zoomrate is against physial display
      others mean zoomrate is against original size

  <screensize> :: auto resizing.
      specify the original screen size by WIDTHxHEIGHT.
      unless screensize is the same size of the physical
      display, zoomrate is calculated automagically.

  Note that if the image is a binary image, current foreground
  and background colors are applied to the drawn image.

%newimage [options] "imagefile"

  Same as %image, but it is much easier to understand.
  options include:
      -colors numcolors
      -xysize piel pixel
      -zoom percentage
      -xyzoom x-percentage y-percentage
    Percentage is against the original image.
    "100" means the original image size, "50" means
    half the original image size.
      -scrzoom percentage
      -xscrzoom percentage
      -yscrzoom percentage
      -xyscrzoom x-percentage y-percentage
    Percentage is against the screen. "100" means screen
    width/height, "50" means half the screen width/height.
    -xscrzoom and -yscrzoom scales image with aspect
    ratio unchanged.

  TODO: supersede %image by %newimage?
  TODO: option for auto resize mode (fit image into the room left on
    the screen)

%prefix "string"
  Place "string" at the beginning of line.
  "string" should be a set of blank characters (/040).

  The effect of %prefix command in %tab command is local to
  tab-indented line.

%icon <arc|box|delta1|delta2|delta3|delta4|dia> <color> <size>
%icon <imagefile> <color> <size>
  add an icon for itemizing lines.
  for example,
    %tab 1 size 5, icon box green 50
  gives you an green box on the leftmost column of line.
  size is the percentage against the current character size.

%bimage "imagefile" [ <screensize> ]
  Specify the name of background image file
  <screensize> :: auto resizing.
      specify the original screen size by WIDTHxHEIGHT.
      unless screensize is the same size of the physical
      display, zoomrate is calculated automagically.

%default <linenum> <list-of-directives>
  Unless nodefault directive is specified, the directives in the
  argument is prepended to the directives of the linenum'th line
  in every page. The syntax of <list-of-directives> is a comma
  separated directives.
  This directive has to be placed in the preamble.

%tab <tabnum> <list-of-directives>
  Apply list of directives, if any of the lines start with tabnum
  tabs.
  This directive has to be placed in the preamble.

%tab <id> <list-of-directives>
  Apply list of directives, if any of the lines start with "&id".
  This directive has to be placed in the preamble.

%page
  A new page starts

%vgap <gapsize>
  Specify vertical gap size of each line
  <gapsize>:: percentage against current character size
    vertical gap = vertical font size * gapsize / 100

%hgap <gapsize>
  Specify horizontal gap size of each line
  <gapsize>:: percentage against current character size
    horizontal gap = vertical font size * gapsize / 100
  NOTE: horizontal gap is calculated based on vertical size,
  because fonts are proportional (horizontal size varies by code point).

%pause
  Stop drawing until forward key or button is pressed

%mark
  Mark the current position on the screen, so that we can come back
  later by %again.
  NOTE: mark is local to a page.  mark will be cleared at the page
  boundary.

%again
  Move current position to the location marked by %mark.

%system "command"
  Fork&exec the specified program.
  NOTE: the program will be invoked every time the page is redrawn.
  It sometimes annoy you.  it needs some rework.

  Special translation for presentation-window-relative geometry:
    Argument that starts with "%" will be translated as if
    it was interpreted relative to presentation window.

    "xeyes -geometry %50x50+25+25"  will be translated
    so that eyes appear on the center of the presentation window.

  The command has to be placed on a line alone.
  Do not use commas.

  Process will be killed when you leave the page.

%system "command" <page>
  Almost same as above.
  Process will be killed when you leave the specified <page>.
  If you set <page> to -1, the process will be killed when MagicPoint
  is terminated. (of course, you can terminate the child process alone
  by yourself)

%filter "command"
TEXT
%endfilter
  Fork&exec the specified program, feed TEXT into that process
  from standard input.  use the standard output from the process
  as presentation input.
  Do not forget to place %endfilter.

  The command has to be placed on a line alone.
  Do not use commas.

%vfcap "filename"
  Specifies VFlib configuration filename.
  (allowed in ~/.mgprc, without "%" sign)

%tfdir "dir"
  Specifies where to find TrueType font by default.
  (allowed in ~/.mgprc, without "%" sign)

%deffont "fontname" <list-of-directives>
  Define a symbolic fontname, by using list-of-directives.
  The directive must appear in the preamble.

  For example, you may want to define a typewriter-like font as:
    %deffont "typewriter" xfont "courier", tfont "cour.ttf"
  By using the above definition, you can make your presentation file
  less dependent to the configuration of magicpoint binary.
  If the configuration allows the use of TrueType "cour.ttf" font,
  "tfont" directive will be effective.  If there's no TrueType font
  available, or FreeType library is not compiled into the magicpoint
  binary you are currently using, "xfont" will be effective.

  "%font" cannot be used in "%deffont".  this is for avoiding infinite
  loops.

%font "fontname"
  Invoke the symbolic fontname defined by %deffont directive.

%embed "filename"
%endembed
  Embedded image support.  uuencoded data fragment can be put between
  the directives.
  NOTE: this directive is not for human beings.  use "mgpembed" command.

%noop
  No operation

%pcache <flag> <mode> <effect> <value>
  <flag> :: enable or disable forward page cache
      0 means disable forward page cache
      1 means enable forward page cache
  <mode> :: cache mode
      0 means caching is executed after 2seconds idle.
      1 means caching is executed immediately.
  <effect> :: type of 'special effect' for the forward page cache (0-2)
  <value> ::  speed of 'special effect'. value 1 means the highest speed.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值