/latex-mscgen

LaTeX package to interface with mscgen (exe)

Primary LanguageTeX

latex-mscgen

LaTeX package to interface with mscgen (exe)

Source : https://github.com/Kochise/latex-mscgen

installation

Get 'mscgen' for Windows : http://www.mcternan.me.uk/mscgen/
Uncompress/install it where you need.
Add it in your global/local/session PATH variable.

\>set PATH=%PATH%;<mscgen>\Msc-generator

xcopy /c /h /e /r /q /y latex-mscgen <miktex>\texmfs\install\tex\latex\mscgen
start "" "<miktex>\miktex-portable.cmd"

Refresh the filename database.
Update the package database.
You should be ready to go.

Alternatively, you can use https://github.com/Kochise/win_portable

usage

See http://msc-generator.sourceforge.net/help/

In your preamble :

\def\imagepath{./images}
\graphicspath{{\imagepath/}}
\usepackage[imagepath=\imagepath]{mscgen}

In your document :

% http://msc-generator.sourceforge.net/help/5.4/Text-Formatting.html
%\begin{mscgen}[width]{caption}{refname}
\begin{mscgen}[8cm]{mscgen caption example}{mscgenexample}
msc {
  hscale = "2";

  a,b,c;

  a->b [ label = "ab()" ] ;
  b->c [ label = "bc(TRUE)"];
  c=>c [ label = "process(1)" ];
  c=>c [ label = "process(2)" ];
  ...;
  c=>c [ label = "process(n)" ];
  c=>c [ label = "process(END)" ];
  a<<=c [ label = "callback()"];
  ---  [ label = "If more to run", ID="*" ];
  a->a [ label = "next()"];
  a->c [ label = "ac1()\nac2()"];
  b<-c [ label = "cb(TRUE)"];
  b->b [ label = "stalled(...)"];
  a<-b [ label = "ab() = FALSE"];
}
\end{mscgen}

options

What is available through 'mscgen.exe' (which is a lot) :

% Puts msc-generator into text editor integration mode
--tei-mode

% Output file type (default is 'png')
-T [png|eps|pdf|svg|ismap|lmap|csh|emf]

% Embed the chart text into 'png' file as an iTXt chunk (uncompressed)
-e

% Output file (png, eps, pdf, svg, emf)
-o <outfile>

% Input file
-i <infile>

% Forces the input file to be interpreted as as a specific type of chart
-S [signalling|graph]

% Forces the input file to be interpreted as UTF-16, even if it looks like UTF-8 or ASCII
--utf16

% Forces the input file to be interpreted as UTF-8, even if it does not look like it
--utf8

% Full-page output ('p' or an 'l' for portrait and landscape)
-p=[A0-A6|letter|legal|ledger|tabloid][l|p]

% Specifies the margin in full-page output (in inches -number only- or in centimeters -appended with 'cm')
-m{lrud}=<margin>

% Set the vertical alignment within a page for full-page output
-va=[center|up|down]

% Set the horizontal alignment within a page for full-page output
-ha=[center|left|right]

% Automatic pagination
-a[h]

% Width (in pixels)
-x=<width>

% Height (in pixels)
-y=<height>

% Scale chart size up or down
-s=<scale>

% Use specified font (must be available in the local system)
-F <font>

% Load additional chart design definitions
-D <design_file>

% Don't load design files
--nodesigns

% Chart option
--chart_option=<value>

% Chart's design pattern
--chart_design

% No warnings displayed
-Wno

% Additional Technical Info is printed about compilation
-TI

% No progress indicator displayed
-Pno

% Display program licence and exit
-l

% Display program help and exit
-h, --help

% Display version information and exit
--version

Options specific to Signalling Charts:

% Forces the chart to be interpreted in mscgen mode
--force-mscgen

% Prevents the chart to be interpreted in mscgen mode
--prevent-mscgen

% Disables warnings for deprecated constructs for backwards compatibility
-Wno-mscgen

% Enforces stricter language interpretation
--pedantic

Cannot be specified on a group basis, only in the preamble.
Just add the requested parameters without the leading/separator dash/underscor(es).

\usepackage[ha={center}]{mscgen}

Avoid :

i	: because used by the provided text
o	: because using the refname
T	: because set to 'eps' (vector) as default
utf8	: because cannot use numbers, alternative below
utf16	: because cannot use numbers, alternative below

For UTF specification, use the following format :

\usepackage[utf={8}]{mscgen}

limitations

Your imagination.

greetings

Based on https://github.com/dakusui/latex-ditaa
Based also upon https://github.com/unjello/msctexen
Help from the community https://tex.stackexchange.com/questions/570758/verbatimout-newenvironment-and-removing-characters/
Also interested into https://github.com/sile-typesetter/sile