[go: up one dir, main page]

Menu

[r12]: / docs / eqc.info  Maximize  Restore  History

Download this file

1862 lines (1364 with data), 70.2 kB

This is eqc.info, produced by makeinfo version 4.13 from
info file generated from .//eqc.sgml by means of linuxdoc-tools.




File: eqc.info,  Node: Top,  Next: Introduction,  Up: (dir)

The EQC Handbook
****************

     `Jan Rheinländer'
     Version 1.4.1, 25.02.2010

   This Handbook describes EQC Version 1.4.1

* Menu:

* Introduction::
* Installation::
* Usage::
* Reference::
* Examples::
* Questions and Answers::
* Copyright::


File: eqc.info,  Node: Introduction,  Next: Installation,  Prev: Top,  Up: Top

1 Introduction
**************

The LaTeX Equation Compiler is a preprocessor for LaTeX files that
enables numeric and symbolic calculations. It reads equations specified
by special keywords in the LaTeX file and uses them to calculate the
numeric value of variables. Symbolic calculation capabilities are also
implemented, for example, adding two equations or substituting a
variable with a numerical or symbolic value into an equation. EQC makes
use of the GiNaC library (`GiNaC library homepage').

   The development of EQC was prompted by a problem which I often
encountered doing calculations in my profession as a mechanical
engineer.  I would first begin writing out the problem on paper,
putting together the necessary equations, and then turn to a
spreadsheet to do the actual calculations. EQC is meant to integrate
this process in a single Latex source file.

   Programming language: C++, bison, flex, using kdevelop.  Implemented
on Linux-i386. Cross-compiled to Windows, but not extensively tested
there.

   EQC makes use of the GiNaC library for numeric and symbolic
calculations, and of course needs a Latex installation to be useful. If
you wish to use physical units, the SIunits.sty package is required as
well.

* Menu:

* Changes::


File: eqc.info,  Node: Changes,  Up: Introduction

1.1 Changes
===========

All code changes are documented in the source files by three asterixes
(***) and the change number.

   *  Version 0.1: First version made accessible on SourceForge. All
     basic functionality implemented.

   *  Version 0.2:

        *  Updated SGML documentation

        *  Added eqc-tour.tex example

        *  Minor code enhancements

   *  Version 0.3:

        *  Minor code enhancements and bug squashing

        *  Changed compile default to static linking because of
          problems with libginac, libcln, libgmp3

        *  Added Precision_type in printing.h, modified printing of
          floats in printing.cpp

        *  Better control of the format in which quantities are printed

        *  Decimal marker is set to `.' or `,' according to the
          language specified

        *  `\preferredunits' no longer adds the units to previously
          registered ones. The old units are now deleted and only the
          new ones used.

        *  The `\val' macros now take an optional parameter to set the
          units for expressing a quantity.

        *  Removed options `thickspace, thickqspace' for `SIunits.sty'
          in `eqc.sty'.  The user should define his preferred spacing
          in SIunits.cfg.

   *  Version 0.4:

        *  Corrected Latex display of `'," as decimal marker by putting
          it in parentheses.

        *  Added class expression to encapsulate the GiNaC `ex' class
          and make it possible to preserve the user's formatting of
          equations using the commands `\raw' and `\eqc'.

        *  EQC now recognizes `\verb' and respects verbatim
          environments.

   *  Version 0.5:

        *  Minor code enhancements

        *  Removed bug that caused EQC to crash if a file mentioned
          after `\input' could not be opened.

        *  Enabled EQC to recognize if the left hand side of an
          equation becomes a symbol through an operator, a substitution
          or a reversal. The equation is then registered so that the
          value of the symbol can be computed if wished.

        *  Manipulating an expression with `+', `-', `*', `/' no sets
          the Latex representation (for `\raw' printing to an empty
          string since the former result was undesirable.

        *  Added support of symbolic functions with the keywords
          `\function' and `\deffunc'. These functions can be defined at
          runtime.

        *  Enabled EQC to parse vectors, i.e. `{x;y}'. This resulted in
          a change of equation list syntax because of the ambiguity of
          the ; in something like `\eqsubst{"prev"}{x = 3; y = 4}'.
          Equations in lists now have to be enclosed in brackets:
          `\eqsubst{"prev"}{{x = 3}; {y = 4}}'

   *  Version 0.6:

        *  Added keyword `\eqpow'.

        *  Enabled parsing of keywords `\lhs' and `\rhs' inside
          expressions.

        *  Implemented more flexible expression substitution and
          removed a bug concerning substitution of functions.

        *  Changed scanner so that the extra brackets in equation lists
          are not necessary any more.

        *  Added keywords `\printeq', `\deleq' and `\eqsimpf'.

        *  Added symbolic differentiation with the keyword `\eqdiff'.

        *  Added function hints to `\function' to allow for nicer
          printing etc.

   *  Version 0.7.0:

        *  Port to g++-3.0 and GiNaC 1.2.1

        *  Removed bug that omitted '-' sign when printing adds

        *  Introduced concept of library equations

        *  Added simplification type "eval" and "normal"

        *  Added automatic normalization after division of expressions

        *  Rewrite of the \val{} algorithm in order to speed things up

        *  Rewrite of all message printing via the new class `message'

        *  Removed `using namespace std' everywhere

        *  Debianized the package

   *  Version 0.8.0:

        *  Added keywords `aligneq', `autoalign', `noautoalign' and
          `dumpeq'

        *  The amsmath keywords `tfrac' and `dfrac' are now recognized
          (but not printed in eqc output)

        *  Implemented keyword nesting (e.g., `\eqsubst{z =
          x^2}{\eqadd{x-y = 4}{y}}', which would result in `z =
          (4+y)^2')

        *  Merged the equation and the file parser to simplify the code.

        *  Implemented operators `+', `-', `*', `/' and `^' for
          equations (e.g. `\eqrev{"prev" + 3y}').

        *  Added simplification type `collect_common'.

        *  Added keywords `\denom' and `\numer'.

        *  Added keyword `\eqsolve'.

   *  Version 0.9.0:

        *  Removed bug which did not print muls inside muls and adds
          inside adds.

        *  Removed automatic expansion and normalization after
          divisions, this must be done manually now using `\eqsimpf'.

        *  Changed `\preferred_units' to `\preferredunits' for LaTeX
          conformity.

        *  Introduced dummy macros in `eqc.sty' to enable the raw tex
          file to be passed through LaTeX without generating too many
          errors. This allows the use of preview-latex in emacs, for
          example.

        *  Added keyword `\eqfunc' to apply a function to both sides of
          the equation.

        *  Added simplification type `unsafe'.

        *  Added keyword`\printoptions', this now replaces `\autoalign'.
          `\raw' and `\eqc' are now printing options `eqraw' and
          `eqnoraw'.

        *  Trigonometric functions now evaluate automatically if
          possible (for example, `\cos(\pi)' becomes 0).

        *  Made `equation' a subclass of `GiNaC::relational' and
          `expression' of `GiNaC::ex', which allows a great deal of
          simplifications in the grammar.

        *  Removed bug which prevented `\val[\degree]{...}' from
          working correctly.

        *  Removed bug which prevented substitutions of user-defined
          functions from working correctly.

        *  Changed the `func::eval()' routine so that it takes
          advantage of the simplification rules defined for GiNaC's
          hard-coded functions, e.g. `\tan\arctan{x} = x'.

   *  Version 1.0.0:

        *  Vectors can now be created with the syntax `begin:end:step'.

        *  Port to gcc3.3.

        *  Added wildcard function `wild()'.

        *  Made differentiation of functions work and print better.

        *  Added keyword `\diff' to create derivatives. They can be
          evaluated (that is, the derivative can be explicitly
          calculated) by `\eqsimpf{...}{diff}'.

        *  Added factorial function `!'.

        *  Added the sum function `\sum'.

        *  Added keyword `\eqevalp' to evaluate functions given in
          parameter form.

        *  Added keyword `\eqwrite' to save equations to a file and
          reuse them in another document.

        *  Added Taylor series creation of an expression with
          `\tseries'.

        *  Optimized the value finding code for faster execution.

        *  Added the `AM_PATH_GINAC' macro to configure.in

        *  Cross-compiled EQC to windows (see section Compilation and
          Installation)

        *  Added Digits = 12 globally to aleviate problems like
          x^(0.99999999999999995)

   *  Version 1.1.0:

        *  Added keywords `\ceil' and `\floor'.

        *  In equations, `i' is now recognized as the imaginary unit
          (square root of -1).

        *  Sorted out some autoconf/automake problems and updated the
          documentation. Cross-compiling to Windows now works with the
          configure/make commands (see that section for details).

        *  `\eqsolve' now handles problems with denominators not equal
          to one.

        *  Added command-line parsing of options (see `eqc -help') (but
          not for the Windows version)

        *  Combined all option keywords into the common syntax
          `\eqcoptions {'key' = 'val'}'

        *  Automatic aligning of equations (formerly `eqautoalign') is
          now always on. It can be overriden by specifying a certain
          alignment type, e.g. `\eq[eqalign=none]{...}'.

   *  Version 1.2.0:

        *  Minor bug fixes.

        *  Any equations that do not have a user-defined label are not
          considered any more for finding values, except if they are a
          direct assignment to a symbol.

        *  Added keywords `\valwith', `quantitywith', `numvalwith' and
          `unitswith'.

        *  Some beautification for the LaTeX printing routine output.

        *  Added simplification type `gather-sqrt' to combine single
          square roots into one root symbol.

        *  Added option `eqsplit' and `eqsplittext' to split a long
          equation at a given operator.

        *  Added option `vecautosize' to automatically size a vector
          (if the step count is given as 0).

        *  Switched to using pkg-config instead of AM_PATH_GINAC, as
          required by ginac >= 1.3.7

   *  Version 1.2.1:

        *  Updated to use libginac 1.4 and libcln5

   *  Version 1.3.0:

        *  Added support for matrices

        *  Removed confusion between the Euler-Mascheroni constant
          (0.57721...) and Euler's number (2.71828...)

   *  Version 1.3.1:

        *  Added support for integrals

        *  Function hint `no_bracket' renamed to `nobracket'

        *  Removed most globals to make linking as a shared library
          easier

        * Version 1.4.0:

        *  The code was split to provide libeqc independently from the
          program eqc

        *  Minor changes to adapt libeqc to iMath

        *  Changed class Unit to use a factory for creating Unit objects

        *  Changed `\eqdiff' to differentiate e.g. `f(x)' to `d
          f(x)/dx' instead of differentiating the function definition.
          The old behaviour can be achieved with the function hint
          `defdiff'.


File: eqc.info,  Node: Installation,  Next: Usage,  Prev: Introduction,  Up: Top

2 Installation
**************

EQC is hosted at `SourceForge'.

* Menu:

* How to obtain EQC::
* Requirements::
* Compilation and installation::
* Using EQC with xemacs auctex mode::
* Cross-compiling for Windows::
* Compiling with Cygwin::
* Binary packages::
* Bugs::


File: eqc.info,  Node: How to obtain EQC,  Next: Requirements,  Up: Installation

2.1 How to obtain EQC
=====================

The `CVS web interface'.  You can also download a source.tgz and binary
packages from the `EQC project page'.


File: eqc.info,  Node: Requirements,  Next: Compilation and installation,  Prev: How to obtain EQC,  Up: Installation

2.2 Requirements
================

To compile and use EQC, the GiNaC, CLN and GMP libraries are required,
as well as the standard C++ development libraries, flex and bison.
Information about these libraries can be found at the `GiNaC library
homepage' and `CLN library homepage' Compilation has been tested with
GiNaC 1.5 using g++-4.4. Older versions will most probably not work.
Of course, a Latex installation is necessary, and the SIunits.sty
package should be present if you wish to use physical units in your
equations.


File: eqc.info,  Node: Compilation and installation,  Next: Using EQC with xemacs auctex mode,  Prev: Requirements,  Up: Installation

2.3 Compilation and installation
================================

In order to compile and install EQC on your system, type the following
in the base directory of the EQC distribution:

     % ./configure
     % make
     % make install

   Since EQC uses `autoconf' you should have no trouble compiling it.
Should you run into problems please report them to the the `author'.

   If all else fails, try executing `make -f Makefile.my' in the source
directory. This compiles EQC independent of all the autoconf stuff, but
of course you may have to tweak the `Makefile.my' to meet your local
requirements.

   If you want more debugging output, set the `msg_info' reporting
level in `main.cpp' to higher, positive values. The default is -1 and 5
is the largest possible value (beware: This might produce a huge amount
of output!)


File: eqc.info,  Node: Using EQC with xemacs auctex mode,  Next: Cross-compiling for Windows,  Prev: Compilation and installation,  Up: Installation

2.4 Using EQC with xemacs auctex mode
=====================================

In xemacs, choose Options-Advanced (Customize)-Group from the menu, and
enter the group name auctex. Open the Command group, and under List:,
add the following entry:

     [INS] [DEL] Name: EQC
                 Command: eqc %t; %l "%(mode)\input{%s.eqc}"
                 How: [Value Menu] TeX-run-LaTeX
                 Create a process for NAME using COMMAND to format FILE with TeX.
     Create a process for NAME using COMMAND to process FILE. *
                 Return the new process.
                 Prompt: [Toggle]  off (nil)
                 Modes: [Value Menu] Set:
                 * Plain TeX
                 * LaTeX
                 * DocTeX
                 * ConTeXt
                 * Texinfo
                 * AmSTeX
                 Menu elements:
                 [INS] [DEL] Lisp expression: :help
                 [INS] [DEL] Lisp expression: "Run EQC, then LaTeX"
                 [INS]

   Choose save from the top of the buffer. To run EQC, followed by
LaTeX, hit Ctrl-C twice in the buffer, and when asked for the command
to run, say eqc (just typing "e" usually is sufficient)


File: eqc.info,  Node: Cross-compiling for Windows,  Next: Compiling with Cygwin,  Prev: Using EQC with xemacs auctex mode,  Up: Installation

2.5 Cross-compiling for Windows
===============================

EQC can be cross-compiled for windows by installing the mingw32
package. The following steps are necessary to build EQC for windows
under Debian GNU Linux:

   *  Compile and install the CLN library (run configure with
     `-host=i586-mingw32msvc -prefix=/usr/i586-mingw32msvc
     -without-gmp', then `make' and `make install').  Maybe it needs to
     be patched (see  `').

   *  Compile and install the gmp library. (run configure with
     `-host=i586-mingw32msvc -prefix=/usr/i586-mingw32msvc', then
     `make' and `make install').  On my system, this requires a patch
     to configure: Replace the statement `BITS_PER_MP_LIMB=`expr 8 \*
     $ac_cv_sizeof_mp_limb_t`' with `BITS_PER_MP_LIMB=32' (or whatever
     value is correct for your system. To find this out, insert an
     `echo $ac_cv_sizeof_mp_limb_t' and multiply by 8 manually).

   *  Compile and install the ginac library (run configure with
     `-host=i586-mingw32msvc -prefix=/usr/i586-mingw32msvc
     -with-cln-prefix=/usr/i586-mingw32msvc', then `make' and `make
     install').. You can ignore the error about libreadline not being
     found, since we will not be needing ginsh.

   *  If make reports an error while compiling input_lexer.cc, edit the
     file config.h created by configure, and at the end, put `#define
     YYTEXT_POINTER 1'. If you don't want to rebuild all the files
     compiled up to then, run `make -t', remove all files with size 0,
     and re-run make.

   *  Probably, linking of ginsh.exe and viewgar.exe will also fail,
     but since they are not necessary, just run `make -t' in the
     subdirectories ginsh and tools.

   *  Adapt the eqc search path in ltxfilelex.ll to your system
     (default: "C:\texmf\tex\latex\eqc\"

   *  Set the environment variable `CPPFLAGS' to `-DMINGW' (Not
     required any more since version 1.4.0)

   *  Run 'make distclean' if necessary.

   *  Run configure with `-host=i586-mingw32msvc
     -prefix=/usr/i586-mingw32msvc
     -with-ginac-prefix=/usr/i586-mingw32msvc'. This might requiree a
     patch to `/usr/i586-mingw32msvc/bin/ginac-config': Replace the
     line saying `echo $libdirs -lginac -L/usr/lib -lcln -lgmp' with
     `echo ${exec_prefix}/lib/libginac.a ${exec_prefix}/lib/libcln.a
     ${exec_prefix}/lib/libgmp.a'

   *  Run `make CXXFLAGS=-O0'. Note that if you try to compile
     ltxfileparse.cc with optimization, you might need huge amounts of
     memory, depending on your system and compiler version.

   *  You might want to strip the eqc.exe binary:
     `i586-mingw32msvc-strip eqc.exe'. This will greatly reduce the
     file size.

   *  Install eqc.exe, eqc.sty, units.tex, substitutions.tex and
     mathconstants.tex into your favourite locations (don't forget to
     run texhash afterwards).

   *  Install the html documentation from the docs subdirectory in your
     favourite location.

   *  Depending on your TeX distribution, you might also have to
     install the siunits and fp packages.  The first is mandatory, the
     second can be disabled if you comment out the makepspicture macros
     in eqc.sty.


File: eqc.info,  Node: Compiling with Cygwin,  Next: Binary packages,  Prev: Cross-compiling for Windows,  Up: Installation

2.6 Compiling with Cygwin
=========================

EQC can be compiled for windows using the Cygwin environment.The
following steps are necessary to build EQC for windows under Cygwin:

   *  Install Cygwin

   *  Install the base system and at least the following packages:

        *  From Devel: autoconf automake bison flex gcc-g++
          libncurses-devel make pkg-config readline

        *  From Interpreters: m4

        *  From Libs: libreadline6

        *  From Math: gmp libgmp-devel libgmp3

        *  From system: util-linux

        *  From utils: diffutils

   *  Get the cln source, run `configure -without-gmp', `make', and
     `make install'

   *  `cp cln.pc /usr/lib/pkgconfig' (or adjust the pkg-config path to
     `/usr/local/lib/pkgconfig' for the following steps).

   *  Get the ginac source, configure, make, make install

   *  `cp ginac.pc /usr/lib/pkgconfig'

   *  Get the autoconf-archive, for example, from `', configure, make
     install.

   *  Get eqc source. Run ` aclocal -I/usr/local/share/aclocal',
     autoconf, automake, autoheader.

   *  Adapt the eqc search path in ltxfilelex.ll to your system
     (default: `C:\texmf\tex\latex\eqc\'

   *  Run 'make distclean' if necessary.

   *  Run `configure CPPFLAGS="-DMINGW"', make. If compilation of
     `ltxfileparse.cc' takes forever, compile it manually with the
     setting `-O0'.  (Note: Setting CPPFlAGS is not required any more
     since 1.4.0)

   *  You might want to strip the eqc.exe binary: `eqc.exe'. This will
     greatly reduce the file size.

   *  Install eqc.exe, eqc.sty, units.tex, substitutions.tex and
     mathconstants.tex into your favourite locations (don't forget to
     run texhash afterwards).

   *  Install the html documentation from the docs subdirectory in your
     favourite location.

   *  Depending on your TeX distribution, you might also have to
     install the siunits and fp packages.  The first is mandatory, the
     second can be disabled if you comment out the makepspicture macros
     in eqc.sty.


File: eqc.info,  Node: Binary packages,  Next: Bugs,  Prev: Compiling with Cygwin,  Up: Installation

2.7 Binary packages
===================

If all this is too complicated for you, RPM and Debian packages have
been released on SourceFourge. They are accessible on the `EQC project
page'.


File: eqc.info,  Node: Bugs,  Prev: Binary packages,  Up: Installation

2.8 Bugs
========

* Menu:

* Known bugs::
* Reporting bugs::


File: eqc.info,  Node: Known bugs,  Next: Reporting bugs,  Up: Bugs

2.8.1 Known bugs
----------------

   *  The option `eqsplit' must be the last one in a list, for example:
     `\eq[eqsplit=2; eqraw=true]{a + b = c}' will not work correctly,
     but `\eq[eqraw=true; eqsplit=2]{a + b = c}' will. The reason for
     this is that `eqsplit' takes an expression as an argument, and the
     definition of an expression allows for a list separated by
     semicolons.  Therefore, an ambiguity occurs.

   *  The number `0.012345' is not rounded correctly to 4 digits
     (precision type fixed_digits), rather the result ist `0.1234'.
     This appears to be a bug in the `cln::round1()' function because
     `1234.5d0' is rounded to `1234', but `1234.56d0' is rounded to
     `1235'!

     Actually, it is not a bug, but a feature. The CLN documentation
     says (!)  `round(x)': The integer nearest to x. If x is exactly
     halfway between two integers, choose the even one.


File: eqc.info,  Node: Reporting bugs,  Prev: Known bugs,  Up: Bugs

2.8.2 Reporting bugs
--------------------

Please report all bugs to the `author'.  You should include the
following information:

   *  Version of eqc, how you obtained it (RPM, CVS, binary or source).

   *  The input file that produces the errors.

   *  The output produced by eqc (on screen and in the file
     `inputname.eqc').

   *  If you compiled eqc yourself, try setting DEBUG to larger values
     to get more debugging output.  This can be done in `main.cpp' by
     increasing the `msg_info' level to positive numbers.


File: eqc.info,  Node: Usage,  Next: Reference,  Prev: Installation,  Up: Top

3 Usage
*******

* Menu:

* General Usage::
* Physical units::
* Library of substitutions::
* Formatting of floating point numbers::
* Formatting of equations::


File: eqc.info,  Node: General Usage,  Next: Physical units,  Up: Usage

3.1 General Usage
=================

EQC reads LaTeX files from the command line and writes its output to
corresponding `.eqc' files. One output file is generated for each file
given on the command line. Note that files included with `\input'
directives are directly included in the output file. EQC keywords
contained in the input files are processed, everything else is written
out unchanged. The resulting `.eqc' files can then be processed like
any regular LaTeX file (don't forget to give the `.eqc' file extension
to latex).

   An auxiliary package needs to be included with `\usepackage{eqc}'.
It takes an optional argument `english' or `german' which defines how
numbers are read (whether a comma or a point is expected as the decimal
marker).  English is the default.

   Inside the Latex file, equations can now be defined and registered.
EQC will read the equation, produce Latex output, and store it for
later manipulation or evalution. For example:

     \documentclass{article}
     \usepackage{eqc}
     \begin{document}
     \input mathconstants.tex
     $$\eq[eq:myequation]{x = a \sin(b)}$$
     $$\eq{a = 3}$$
     $$\eq{b = 3.141/2}$$
     $$\printeq{"eq:myequation"} = \val{x}$$
     \end{document}

   This would produce the following Latex output (without the preamble
created by including mathconstants.tex):

     $$x = a sin(b)$$
     $$a = 3$$
     $$b = 1.57$$
     $$x = a sin(b) = 3$$

   In order to determine the value of the variable `x', EQC
automatically uses the three equations that were registered with the
keyword `\eq'. Note that only equations that have in this way been
explicitly registered with EQC will be used! Any other equations
present in the file are ignored. To see what else is possible in EQC
have a look at the example and the reference section.


File: eqc.info,  Node: Physical units,  Next: Library of substitutions,  Prev: General Usage,  Up: Usage

3.2 Physical units
==================

Because EQC was developed to tackle mechanical engineering problems, it
supports physical units. The Latex side is handled by SIunits.sty,
which needs to be present on your system (it is included, for example,
in the tetex distribution). Units inside equations are designated by
their Latex macro names, e.g., `\mm'.  Variable values can take on four
different forms:

  1.  A numerical value, like 4 or 3.141.

  2.  A unit, like `\mm'

  3.  A physical quantity, that is, a united and a number, like `4
     \mm'. This form of course includes the first two ones.

  4.  Any other kind of mathematical expression, like `x + 4 \mm'. This
     of course includes the other three forms.

   The `\val' keyword used in the example above prints the fourth kind
of variable value. If we had wished to ensure that a numerical value is
printed, we would have used `\numval'. EQC will then print a warning if
the value of the variable does not have this form.


File: eqc.info,  Node: Library of substitutions,  Next: Formatting of floating point numbers,  Prev: Physical units,  Up: Usage

3.3 Library of substitutions
============================

The file substitutions.tex contains a growing library of equations that
are useful for working with symbolic equations, for example,
`\sin(\alpha + \beta) = \sin\alpha \cos\beta + \cos\alpha \sin\beta' or
`\sin(\pi - \alpha) = \sin\alpha'. By substitution, they can be adapted
to special cases:

     $$\eq{\cos\phi = \sin(\phi + \psi)}$$
     $$\eqsubst{"prev"}{"lib:trig:sina+b"}$$

   which would produce the following output:

     $$\cos\phi = \sin(\phi + \psi)$$
     $$\cos\phi = \sin\phi \cos\psi + \cos\phi \sin\psi$$


File: eqc.info,  Node: Formatting of floating point numbers,  Next: Formatting of equations,  Prev: Library of substitutions,  Up: Usage

3.4 Formatting of floating point numbers
========================================

There are several options available to control how floating point
numbers are printed. The precision can be set to a specific number of
digits with `\eqcoptions{precision = 'num'}'.Two different concepts of
precision are implemented, these can be selected by
`\eqcoptions{precision_type = fixed_marker}' or
`\eqcoptions{precision_type = fixed_digits}'.

  1.  Fixed marker: All numbers are printed with a fixed number of
     digits after the decimal marker.  For example, let the precision
     be three digits. Then 1.2345 will be printed as 1.235, and
     1234.5678 will be printed as 1234.568.

  2.  Fixed digits: All numbers are printed with a fixed number of
     digits precision. For example, let the precision be three digits.
     Then 1.2345 will be printed as 1.23, and 1234.5678 will be printed
     as 1230.

   Very large and very small numbers should be printed in scientific
format (mantissa * 10^exponent) for the sake of readability. The limits
which determine what a "very large" or "very small" number is can be
set with `\eqcoptions{scientific_limit_low = 'num'}' and
`\eqcoptions{scientific_limit_high = 'num'}'.


File: eqc.info,  Node: Formatting of equations,  Prev: Formatting of floating point numbers,  Up: Usage

3.5 Formatting of equations
===========================

Using the command `\eqcoptions{eqraw = true/false}' in you Latex input
file makes it possible to choose whether `\eq' statements should be
formatted the way you typed them or whether EQC should use it's own
output function to format them. Note that any equations obtained by
`\eqadd' etc. will always have the EQC formatting, as EQC can hardly
foresee what you would have typed if you had written this equation
yourself.

   EQC formats equations inside certain environments (`eqnarray',
`align' etc.)  automatically, that is, the correct number of ampersands
(`&') is added before/after the equal sign. You can override the
formatting by setting the `eqalign' option manually.


File: eqc.info,  Node: Reference,  Next: Examples,  Prev: Usage,  Up: Top

4 Reference
***********

* Menu:

* Basic syntax::
* Keywords in the Latex file::
* Keywords inside equations::
* Command line arguments::


File: eqc.info,  Node: Basic syntax,  Next: Keywords in the Latex file,  Up: Reference

4.1 Basic syntax
================

There are two categories of keywords recognized by EQC: Keywords in the
Latex file, and keywords inside equation statements. The syntax used to
describe the keywords is:

     keyword [optarg1] [optarg2] ... {argument1} {argument2} ...

   Arguments in square brackets are optional.

   The following abbreviations for the different types of arguments are
used:

`exp'
     A mathematical expression like x + sin(y).

`equation: exp = exp'
     An equation created by equating two mathematical expressions.

`equation: exp & = & exp'
     Same as before, but inside an equation array. Other positions of
     the `&' are possible as well.

`equation: "label"'
     EQC optionally accepts an equation label in any place where an
     equation is required. Labels must be enclosed in double quotes.
     The special equation label `"prev" references the last equation
     that was registered with EQC.

`eqlist: equation OR equation ; equation ; equation ...'
     Either a single equation or a list of equations separated by
     colons.

`unitlist: unit ; unit ; unit ...'
     A list of physical unit names like \mm; \N, separated by colons.

`explist: exp ; exp ; exp ...'
     A list of expressions like x; y; z^2, separated by colons.

`simplifications: simplification ; simplification ; simplification ...'
     A list of strings describing simplifications to be performed on an
     equation.

`vector: start : end : step'
     A vector beginning at `start' and ending at `end', with steps of
     `step'. If `end - start' is not a multiple of `step', the last
     element of the vector will be smaller than `end'. If you don't
     care about the size of the step, give a value of 0: EQC will make
     the vector have the number of elements defined by the option
     `vecautosize' (default 20).

`matrix: {element1; element2; ... elementN} OR {{element11; element12; ... element1N}; { ... }; {elementM1; ... elementMN}}'
     A vector or a matrix of arbitrary expressions. The brackets are
     important, but not the type of bracket. A matrix can be used
     anywhere an expression is allowed.


   Numbers can have the imaginary unit `i', which on the other hand
means that you cannot use `i' as a variable name.


File: eqc.info,  Node: Keywords in the Latex file,  Next: Keywords inside equations,  Prev: Basic syntax,  Up: Reference

4.2 Keywords in the Latex file
==============================

* Menu:

* Keywords for manipulating equations::
* Keywords for manipulating expressions::
* Keywords for defining new units and functions::
* Keywords for printing results::
* Output formatting::
* Other EQC options::
* Miscellaneous::


File: eqc.info,  Node: Keywords for manipulating equations,  Next: Keywords for manipulating expressions,  Up: Keywords in the Latex file

4.2.1 Keywords for manipulating equations
-----------------------------------------

All these keywords take several optional arguments. The asterisk form
suppresses printing the equation. A label may be given to the equation
in square brackets. In addition, all the options listed for the keyword
`eqcoptions' can be used and will then apply for this equation only.
Note that if only an equation label and no further option is provided
the square brackets, the key `label =' can be omitted, and the label
does not need to be quoted (`""').

`\constant [*] {equation}'
     Registers a constant with EQC. Constants are not erased by
     `\clearequations'. This makes it possible to specify general
     constants only once in the file and reuse them for several
     different calculations. The value assigned to this constant is
     automatically used when calculating the value of variables. The
     asterix form suppresses printing of the constant equation in the
     Latex output file.

`\eq [*] [[label]] {equation}'
     Registers an equation with EQC. Only equations that have been
     registered are used to calculate the values of variables. The
     asterix form suppresses printing of the equation in the Latex
     output file. The equation can be assigned an optional label which
     may be used to reference it later on in the file. The Latex
     `\ref{}' command will also work with this label.  Note that here
     the label may not be surrounded by quotes!  For the special case
     of the equation label starting with `lib:', the equation will not
     be erased by `\clearequations'. This is useful for building a
     library of generic equations, as for example in the file
     `substitutions.tex'.

`\deleq{label}'
     Removes an equation such that it has no influence on future
     searches for variable values. Note that since LaTeX does not
     support removing labels, the label itself will be not be re-usable!

`\eqadd [*] [[label]] {equation}{expr}'
     Adds an expression to the equation.  A label may be assigned to
     the result. The resulting equation is only registered with the EQC
     if it has been assigned a label. The reason for this is that the
     equation is usually redundant in terms of using it for calculating
     the value of variables. The asterix form suppresses printing of
     the resulting equation.

`\eqdiv [*] [[label]] {equation}{exp}'
     Divides the equation by an expression. The asterix suppresses
     Latex output, the label enables the equation to be referenced
     later and causes it to be registered with the EQC.

`\eqmul [*] [[label]] {equation}{exp}'
     Multiplies the equation with an expression. The asterix suppresses
     Latex output, the label enables the equation to be referenced
     later and causes it to be registered with the EQC.

`\eqpow [*] [[label]] {equation}{exp}'
     Raises both sides of the equation to the power of an expression.
     _Beware:_ This ignores alternative results, as in the case of
     `\eqpow{x^2}{1/2}', which might evaluate to `+x' or `-x'. Only use
     this function if you are sure that you want the first possible
     result!

`\eqfunc [*] [[label]] {equation}{exp}'
     Applies the expression, which must be a valid function name
     (without parameters), to both sides of the equation.

`\eqsub [*] [[label]] {equation}{exp}'
     Subtracts an expression from the equation. The asterix suppresses
     Latex output, the label enables the equation to be referenced
     later and causes it to be registered with the EQC.

`\eqrev [*] [[label]] {equation}'
     Swaps left hand side and right hand side of the equation. The
     asterix suppresses Latex output, the label enables the equation to
     be referenced later and causes it to be registered with the EQC.

`\eqsubst [*] [[label]] {equation}{eqlist}'
     Substitutes expressions inside an equation. The `eqlist' argument
     is a list of equations separated by ';'. Any occurences of the
     left hand side of these equations is replaced by the right hand
     side. The asterix suppresses Latex output, the label enables the
     equation to be referenced later and causes it to be registered
     with the EQC.

`\eqsimpf [*] [[label]] {equation}{simplifications}'
     Simplifies both sides of the equation according to the
     simplifications given in a list. Possible values are:

    `expand'
          Fully expands all expressions, including function arguments.

    `expandf'
          Only expand function definition, not arguments.

    `eval'
          Numerically evaluate the equation as far as possible.

    `normal'
          Normalize the equation (see description of GiNaC normal()
          method).

    `collect-common'
          Collect common factors (see description of GiNaC
          collect_common_factors() method).

    `unsafe'
          Does unsafe simplifications, for example

             *  `\sqrt{x^2} => x'

             *  `\arctan\tan{x} => x'. Note that the opposite
               `\tan\arctan{x}' is not an unsafe evaluation and is thus
               done automatically (by GiNaC).

    `diff>'
          Evaluates differential function `\diff'.

    `sum'
          Evaluates sum functions `\sum'.

    `gather-sqrt'
          Gathers single square roots under one root symbol.

    `integrate'
          Symbolically integrates any integrals in the expression (if
          possible)


`\eqsolve [*] [[label]] {equation}{exp}{exp}'
     Solves the equation for a given variable.  The last argument
     indicates which solution is requested (in case there are several
     solutions, like for a quadratic equation). The function returns an
     assignment for the variable.



File: eqc.info,  Node: Keywords for manipulating expressions,  Next: Keywords for defining new units and functions,  Prev: Keywords for manipulating equations,  Up: Keywords in the Latex file

4.2.2 Keywords for manipulating expressions
-------------------------------------------

`\lhs {equation}'
     Returns the left hand side of the equation.

`\rhs {equation}'
     Returns the right hand side of the equation.

`\val [[int]] [[unitlist]] {exp}'
     EQC replaces this keyword with the value of the specified
     expression (which usually is, but need not be, a variable). EQC
     tries to derive the value from the given equations in the form of
     a physical quantity. If this is not successful, a symbolic
     expression will be printed instead. Any floating point numbers
     will be printed with an optional precision. If the quantity should
     be expressed in other units than those set by `\preferredunits', a
     list of units can be passed as an optional parameter.

`\valwith [[int]] [[unitlist]] {exp} {exp}'
     An additional list of assignments can be given to find the value.
     All the assignments given are registered as new equations and then
     the value is searched for. This is the same as doing

                                                  \eq*[eq:temp_1]{assignment_1}%
                                                  ...
                                                  \eq*[eq:temp_n]{assignment_n}%
                                                  \val{exp}
                                                  \deleq{"eq:temp_1"; ... "eq:temp_n}%

`\quantity [[int]] {exp}'
     Same as val, but an error is printed if the value of the variable
     is no quantity. Any floating point numbers will be printed with an
     optional precision.

`\numval [[int]] {exp}'
     Same as val, but an error is printed if the value of the variable
     is no number. Any floating point numbers will be printed with an
     optional precision.

`\units [[int]] {exp}'
     Same as val, but an error is printed if the value of the variable
     is no unit or a multiplication of several units and/or powers of
     units. Any floating point numbers will be printed with an optional
     precision.

`\eqeval{equation}{equation}'
     Evaluates the first equation to a matrix of values. The second
     equation needs to have the form `sym = vector'. The symbol is
     treated as the independent variable, and the equation is evaluated
     for all values of the symbol given in the vector. The result is a
     2x2 matrix, with the values of the independant variable in the
     first column and the evaluation results in the second column. For
     example: `\eqeval{y = x^2}{x = 1:5:1}' would become `[1; 4; 9; 16;
     25]'

`\eqevalp{x-equation}{y-equation}{equation}'
     Evaluate a function given in parameter form to a matrix of values.
     Example (the evolvent function): `\eqevalp{x = R (\cos t + t \sin
     t)}{y = R(sin t - t \cos t)}{t = 0:90\degree:5\degree}'

`\numer{exp}'
     Returns the numerator of the expression.

`\denom{exp}'
     Returns the denominator of the expression.

`\diff{exp;var;num}'
     Creates a differential of the expression with respect to `var' to
     the degree of `num'. It can be evaluated using
     `\eqsimpf{exp}{diff}'

`\sum{equation;exp;exp}'
     The sum function. The first equation is the lower bound, the
     second the upper bound, the third the expression to sum up.
     Example: `\sum{n=1;3;n}'. Note that the bounds must become integer
     values when the function is evaluated with `\eqsimpf{exp}{sum}'.

`\tseries{exp}{equation}{exp}'
     Creates a Taylor series for the first expression. The second
     parameter must have the form `sym = number'. The series is created
     for the dependant variable `sym' around `number'. The third
     parameter must be an integer defining the degree of the series
     expansion.

`\ceil{exp}{digits}'
     Return the numeric value of the expression, rounded up to the
     nearest integer with the given number of digits after the decimal
     point.

`\floor{exp}{digits}'
     Return the numeric value of the expression, rounded down to the
     nearest integer with the given number of digits after the decimal
     point.



File: eqc.info,  Node: Keywords for defining new units and functions,  Next: Keywords for printing results,  Prev: Keywords for manipulating expressions,  Up: Keywords in the Latex file

4.2.3 Keywords for defining new units and functions
---------------------------------------------------

`\defunit [*] [latexname] {macro}{exp}'
     Defines a new unit. The `macro' is the name of the unit, this must
     begin with a backslash because a Latex macro will be created with
     this name for referencing the unit later on. The expression
     defines the unit in terms of units already known to the EQC.  If
     this expression contains data types apart from units, powers of
     units, numerics, or constants already known to EQC, a warning is
     issued, but the unit definition is created anyway.

     To suppress the generation of the Latex command for this unit, use
     the asterix form. If you wish the Latex macro to output something
     other than the expression, supply this as an optional argument. It
     will be printed in the mathrm font.

`\function [[hints]] {name} {explist}'
     Registers a user-defined function with EQC. The function has the
     arguments given in the explist. Example: `\function{f}{x;y}'. The
     function may be used in equations and expressions with or without
     arguments. The following hints are possible:

    `lib'
          This is a library function. It will not be erased by
          `\clearequations'.

    `trig'
          This is a trigonometric function. It will be printed as sin²x
          instead of (sin(x))² (for example).

    `nobracket'
          This functions needs no brackets when printed (for example,
          the `sqrt()' function).

    `expand'
          The function will be expanded immediately (provided it has
          been given a definition). This is useful for example with
          `square()' und `cubic()'


`\deffunc [*] {name}{exp}'
     Define an expression which will be used to evaluate the function,
     for example, `\deffunc{f}{ax^2+bx+c}'. Without the asterix, this
     command will produce output like `f(x) = ax^2 + bx + c'.



File: eqc.info,  Node: Keywords for printing results,  Next: Output formatting,  Prev: Keywords for defining new units and functions,  Up: Keywords in the Latex file

4.2.4 Keywords for printing results
-----------------------------------

`\printeq {equation}'
     Prints the equation (this will usually be an equation label)

`\printvector{exp}'
     Prints a vector in the format required by pstricks.sty.

`\eqwrite\filename{equation}{label}'
     Write an equation to a file. The equation has the label as given.
     This is useful to create a file of equations, which can then be
     included into another document and reused there. A typical usage
     would be       \printoptions{eqparse}%Turn off pretty-printing of
     equations       \newwrite\eqfile%       \immediate\openout\eqfile
     filename.tex%
     \eqwrite\eqfile{\printeq{"eq:example"}}{eq:example}%
     \immediate\closeout\eqfile%       \printoptions{eqnoparse}%

     This file could then be reused as follows:      \input filename.tex
         Equation \eqcref{"eq:example"} in 'whatever original file it
     came from' states      \begin{equation}
     \printeq{"eq:example"}      \end{equation}



File: eqc.info,  Node: Output formatting,  Next: Other EQC options,  Prev: Keywords for printing results,  Up: Keywords in the Latex file

4.2.5 Output formatting
-----------------------

All options are handled by the common keyword `\eqcoptions'. It takes a
list of key-value pairs

`label = `string' Specifies a label for the equation, the label must be enclosed in quotes (`""').'

`precision = integer'
     Specifies what precision is to be used for printing floating point
     numbers. The precision is the absolute number of digits printed,
     more digits are rounded away. The precisions is 4 by default.

`fixeddigits = true|false'
     Specifies whether floating point numbers should be printed with a
     fixed number of digits after the decimal marker or with a fixed
     number of digits in total. The default is fixed_digits.

`lowsclimit = exp'
     Defines the low limit beyond which floating point numbers are
     printed as `mantissa * 10^exponent'.

`highsclimit = exp'
     Defines the high limit beyond which floating point numbers are
     printed as `mantissa * 10^exponent'.

`units = unitlist'
     Specifies a list of units separated by ';' preferred for printing
     physical quantities.  If no such list is specified, the SI base
     units are used. This usually makes for ugly output, for example,
     when printing forces the unit Newton. A useful list of preferred
     units for mechanical engineering might be `{\mm; \N; \Nm;
     \Nosqmm}'. The order in which the preferred units are specified is
     important! Simple units should be specified first, more complex
     ones later on. The reason is that the complex units usually imply
     the simpler ones, for example, `\N' implies `\mm' because 1 `\N'
     equals 1 `kg m/s^2'.

`eqchain = true|false'
     Omit the left hand side in chains of equations, in cases where only
     the rhs changed from one line to the next.

`eqraw = true|false'
     Raw formatting of `\eq' statements means that the equations are
     printed exactly as you typed them in. This of course only works
     until you manipulate the equation with `\eqadd' etc. The other
     options is to have EQC format your equations.

`eqparse = true|false'
     Turns of some pretty-printing features that make the LaTeX output
     of EQC difficult to re-parse. For example, cos^2(x) is printed as
     (cos(x))^2.

`eqalign = type'
     Change the LaTeX alignment type of an equation. Values for `type'
     are 'onlyleft' (alignment will be `&=', for ams math), 'both'
     (`&=&', for eqnarray environment), 'none'.  If no alignment type
     is specified, EQC automatically formats depending on the
     environment.

`eqsplit = exp'
     Split the equation after the nth operand. The count starts at the
     left hand side of the equation. Operands are those parts of the
     equation that are separated either by addition/subtraction or
     multiplication symbols.  At the given position, `\\\notag' or
     `\\\nonumber' are printed, depending on the environment

`eqsplittext = string'
     The text to interject after the split (in quotes `""'). By default,
     this tries to align     the second part of the equation to the
     right of the equals sign.

`difftype = string'
     Set the format for displaying derivatives. Possible values are
     `dfdt' for `df/dx' display (this is also the default), `dot' to
     display one or two dots for the first and second derivative
     (usually used only for derivatives respective to the time `t', and
     `line' to display apostrophes (e.g. `f"(x)').

`path = string'
     Set the path for the EQC-specific data files (default
     `"/usr/share/texmf/tex/latex/eqc/"' on Unix systems).

`lang = "english"|"german"'
     Changes the language which EQC expects the input file to use. At
     the moment, this only has an effect on parsing floating point
     numbers, i.e., the decimal separator is set to ',' for `"german"'
     and to '.' for `"english"' or any other language.



File: eqc.info,  Node: Other EQC options,  Next: Miscellaneous,  Prev: Output formatting,  Up: Keywords in the Latex file

4.2.6 Other EQC options
-----------------------

Further key-value pairs to `\eqcoptions' are:

`vecautosize = integer'
     Specifies the size of a vector when no step count is given (i.e.,
     the count is zero, `x = 10:20:0'. In this case, the vector will
     have the number of elements as given with this option (default 20).



File: eqc.info,  Node: Miscellaneous,  Prev: Other EQC options,  Up: Keywords in the Latex file

4.2.7 Miscellaneous
-------------------

`\clearequations'
     Clears the list of equations and variables. Constants are not
     cleared.  Functions are cleared except for those declared in the
     file mathconstants.tex.

`\input filename'
     Includes the specified file. There is no difference to the Latex
     `\include' command. All include files are written to one output
     .eqc file. The extension .tex need not be given.

`\dumpeq'
     Write a list of all equations known to the compiler into the
     output file. The list is sorted by variable name (for assignments)
     and includes the equation label and number.  This list is very
     useful in larger projects where it is difficult to remember the
     label of a specific equation and where it was defined. Note: This
     command requires AMS maths to be loaded and sets
     `allowdisplaybreaks[1]'!

`\usepackage[language]{eqc}'
     This command must be used in the Latex preamble to include some
     EQC-specific commands. For the meaning of the `language'
     parameter, see `\eqlang'.



File: eqc.info,  Node: Keywords inside equations,  Next: Command line arguments,  Prev: Keywords in the Latex file,  Up: Reference

4.3 Keywords inside equations
=============================

EQC does not parse all of the possible Latex mathematical keywords. The
following keywords and tokens are recognized:

`Basic mathematics'
     Apart from the basic addition, subtraction, multiplication and
     division symbols, EQC interprets the '^' and '_' symbols in the
     same way as Latex does. Note that the '*' multiplication symbol
     may be omitted, just as in Latex.

`Mathematical functions'
     The functions listed below are recognized. All of these are
     defined in the file mathconstants.tex, which needs to be included.
     Further functions may be defined at runtime with the `\function'
     and `\deffunc' keywords.

        * \arccos Arcus cosine.

        * \arcosh Hyperbolic arcus cosine.

        * \arcsin Arcus sine.

        * \arsinh Hyperbolic arcus sine.

        * \arctan Arcus tangens

        * \artanh Hyperbolic arcus tangens.

        * \cos    Cosine.

        * \cosh   Hyperbolic cosine.

        * \cot    Cotangens

        * \coth   Hyperbolic cotangens

        * \csc    Cosecans

        * \cubic  Cubic function (x^3)

        * \exp    Exponential function (e^x).

        * \ln     Natural logarithm.

        * \log    Decimal logarithm

        * \sec    Secans

        * \sin    Sine.

        * \sinh   Hyperbolic sine.

        * \square Square function (x^2)

        * \sqrt   Square root

        * \tan    Tangens.

        * \tanh   Hyperbolic tangens.

        * !       Factorial function

`Brackets'
     All the standard Latex brackets are recognized: `{, \lbrace, (, [,
     \lbrack, \lfloor, \lceil, \langle' and of course the corresponding
     right brackets. The brackets may be modified in their size by
     `\left, \bigl, \Bigl, \biggl, \Biggl' and `\right' etc. EQC checks
     for bracket mismatches and issues a warning. Note that EQC does
     not preserve your bracket types, but creates its own brackets and
     bracket sizes in the Latex output.

`Division'
     The Latex keywords `\over' and `\frac' are recognized.

`Access to equations'
     Equations may be accessed using the `\lhs' and `\rhs' keywords.
     This will provide the left hand side resp. the left hand side of
     the equation. An equation label may be given instead of an
     equation.

`Variable evaluation'
     Variable evaluation with the keywords `\val', `quantity',
     `\numval' and `\units' can take place inside equations. For
     details on how this works, see the corresponding keywords in the
     description above.  Constants EQC has the following built-in
     constants:

        * \pi     3.14159...

        * \e      2.71828...

        * \Euler  0.57721...

`Numbers'
     EQC recognizes integers and floating point numbers. The latter may
     not be in scientific notation as of yet.  Whether the decimal
     separator is a comma or a dot is determined by the `\eqlang'
     keyword, or by the language parameter to
     `\usepackage[language}{eqc}'.

`Vectors'
     A vector can be created with the syntax `begin:end:step'. For
     example, `x = 1:3:1' will create a vector with three rows,
     containing the number 1, 2 and 3.

`Integrals'
     A symbolic integral can be created with the syntax `\integral(x=a;
     b; f(x))' where x is the integration variable, a the lower and b
     the upper bound, and f a function in the integration variable.
     Note that if f(x) does not explicitly mention x, then the result
     will not be what you expected.

`Variables'
     Any letter that is not part of a keyword is assumed to be a
     variable. Variable names are registered automatically on their
     first appearance. Any occurence of the same letter is taken to
     mean the same variable, until a `\clearequations' command is read.
     Any Latex macros that are not known to EQC are also interpreted as
     variable names, e.g., `\phi'.

`Physical units'
     Physical units are identified by their Latex macro name, e.g.,
     `\mm'. Any units other than the base SI units need to be defined
     with `\defunit' (include the file `units.tex' to get the most
     common physical unit definitions).

`Percentages'
     To express percentages in an equation, use the `\percent' keyword.



File: eqc.info,  Node: Command line arguments,  Prev: Keywords inside equations,  Up: Reference

4.4 Command line arguments
==========================

`-d --debug LEVEL'
     Produce debugging and informational output at level LEVEL

`-p --path PATH'
     Path to EQC specific files (eqc.sty etc.)

`-v --verbose'
     Produce verbose output (same as -d1)

`-q --quiet'
     Don't produce any output (same as -d-1)

`-s --silent'
     Don't produce any output (same as -d-1)

`-V --version'
     Print program version

`-? --help --usage'
     Produce informational output


   Note that as of version 1.2.0, command line arguments are not yet
supported on Windows.


File: eqc.info,  Node: Examples,  Next: Questions and Answers,  Prev: Reference,  Up: Top

5 Examples
**********

The `EQC tour' gives an overview of EQC functionality. It was created
with the following commands on the source file `eqc-tour.tex':

     eqc eqc-tour.tex
     latex eqc-tour.eqc

   If you do not have a DVI viewer installed, try the `eqc-tour.pdf'
produced with pdflatex. In case you are curious what your Latex source
looks like after EQC has had a go at it, have a look at the
intermediate file `eqc-tour.eqc'.


File: eqc.info,  Node: Questions and Answers,  Next: Copyright,  Prev: Examples,  Up: Top

6 Questions and Answers
***********************

* Menu:

* Why is the spacing between numbers and units ugly?::
* Why is the spacing between units ugly?::
* Why doesn't substitution of `x^2 = y' work in `1/x^2'?::
* How do I get EQC to accept a variable name like `\varphi''?::
* EQC complains about a wrong number of arguments for a self-defined function::
* EQC does not use my library functions for finding variable values::
* How do I use bibtex with EQC?::
* Why do my equations look ugly?::
* AMS math complains about multiple labels::
* Why does my self-compiled EQC crash immediately?::
* When I try to build the package the command `ccache' is not found::
* The program does not build-::
* Autoconf says that the GiNaC library is not present or has a wrong version but that's not true-::
* KDevelop throws a fit after I run dpkg-buildpackage or do a configure by hand::


File: eqc.info,  Node: Why is the spacing between numbers and units ugly?,  Next: Why is the spacing between units ugly?,  Up: Questions and Answers

6.1 Why is the spacing between numbers and units ugly?
======================================================

You can control your spacing in the `SIunits.cfg' file. EQC simply uses
the `\unit' macro to display physical quantities.


File: eqc.info,  Node: Why is the spacing between units ugly?,  Next: Why doesn't substitution of `x^2 = y' work in `1/x^2'?,  Prev: Why is the spacing between numbers and units ugly?,  Up: Questions and Answers

6.2 Why is the spacing between units ugly?
==========================================

See above


File: eqc.info,  Node: Why doesn't substitution of `x^2 = y' work in `1/x^2'?,  Next: How do I get EQC to accept a variable name like `\varphi''?,  Prev: Why is the spacing between units ugly?,  Up: Questions and Answers

6.3 Why doesn't substitution of `x^2 = y' work in `1/x^2'?
==========================================================

This is a problem with GiNaC's canonical format of expressions. Your
equation will be represented as `x^(-2)', so you need to substitute
`x^(-2) = 1/y'. This is perhaps more of a bug than a feature, but
difficult to solve without manipulating GiNaC's internals.


File: eqc.info,  Node: How do I get EQC to accept a variable name like `\varphi''?,  Next: EQC complains about a wrong number of arguments for a self-defined function,  Prev: Why doesn't substitution of `x^2 = y' work in `1/x^2'?,  Up: Questions and Answers

6.4 How do I get EQC to accept a variable name like `\varphi"?
==============================================================

This is not possible at the moment, but you can circumvent the problem
by defining a new macro, e.g.  `\newcommand{\varphis}{\varphi'}'.


File: eqc.info,  Node: EQC complains about a wrong number of arguments for a self-defined function,  Next: EQC does not use my library functions for finding variable values,  Prev: How do I get EQC to accept a variable name like `\varphi''?,  Up: Questions and Answers

6.5 EQC complains about a wrong number of arguments for a self-defined function
===============================================================================

Probably you did something like: `\function{x}{y; z} $\eq{a = x b +
c}$'. Because functions have precedence over multiplication, EQC parsed
this as `a = x(b; ' and then complained about the missing second
argument. EQC does not require function arguments to be enclosed in
brackets, so you can write `\cos\alpha' instead of `\cos{\alpha}'.
There are several ways to solve your problem:

   *  Provide a multiplication symbol: `x \cdot b'

   *  Use brackets: `{x} b'

   *  Provide function arguments `x(y;z) b'


File: eqc.info,  Node: EQC does not use my library functions for finding variable values,  Next: How do I use bibtex with EQC?,  Prev: EQC complains about a wrong number of arguments for a self-defined function,  Up: Questions and Answers

6.6 EQC does not use my library functions for finding variable values
=====================================================================

This is not a bug, but a feature: Library functions are assumed to be
generic and must be adapted to the special purpose you have in mind.
For details, see the HTML documentation. Basically, you need to
'activate' the equation with either `\eq{"lib:myeq"}' or something like
`\eqsubst{"lib:myeq"}{x = x_1; y = y_1}'.


File: eqc.info,  Node: How do I use bibtex with EQC?,  Next: Why do my equations look ugly?,  Prev: EQC does not use my library functions for finding variable values,  Up: Questions and Answers

6.7 How do I use bibtex with EQC?
=================================

Just run bibtex on the original TeX file, not on the .eqc file.


File: eqc.info,  Node: Why do my equations look ugly?,  Next: AMS math complains about multiple labels,  Prev: How do I use bibtex with EQC?,  Up: Questions and Answers

6.8 Why do my equations look ugly?
==================================

EQC's formatting algorithm is far from perfect. In fact, it will never
become perfect because different people have different ideas about what
a properly formatted equation should look like. You can alleviate this
problem by using the `\raw' statement. This means that the contents of
your `\eq' statements retain the original formatting. Of course, this
option does not work with equations obtained by `\eqadd' etc. as there
is no original formatting. After all, EQC is designed to save you the
work of typing all these equations yourself!


File: eqc.info,  Node: AMS math complains about multiple labels,  Next: Why does my self-compiled EQC crash immediately?,  Prev: Why do my equations look ugly?,  Up: Questions and Answers

6.9 AMS math complains about multiple labels
============================================

AMS math puts out an error message like `Error: Multiple \label's:
label '...' will be lost'.  This error occurs (for example, inside an
`align' environment) if you use `\notag' with an equation that has a
label, e.g.: `\eqadd[eq:1]{x = 3}{4}\notag'. EQC will automatically add
a `\label{eq:1}' when it processes the equation, and AMS math now
complains that the equation has a label but should not be tagged at the
same time! You can use `\tag*{}' to circumvent the problem.

   Note that the standard `eqnarray' environment does not produce this
error.

   This error occurs (for example, inside an `align' environment) if
you use `\notag' with an equation that has a label, e.g.:
`\eqadd[eq:1]{x = 3}{4}\notag'. EQC will automatically add a
`\label{eq:1}' when it processes the equation, and AMS math now
complains that the equation has a label but should not be tagged at the
same time! You can use `\tag*{}' to circumvent the problem.

   Note that the standard `eqnarray' environment does not produce this
error.


File: eqc.info,  Node: Why does my self-compiled EQC crash immediately?,  Next: When I try to build the package the command `ccache' is not found,  Prev: AMS math complains about multiple labels,  Up: Questions and Answers

6.10 Why does my self-compiled EQC crash immediately?
=====================================================

There appears to be a problem with different versions of libginac,
libgmp, libcln. Not all versions of these libraries work with EQC. If
you have such a problem, try using one of the binary packages. These
contain statically linked versions of the libraries See also the bugs
section.


File: eqc.info,  Node: When I try to build the package the command `ccache' is not found,  Next: The program does not build-,  Prev: Why does my self-compiled EQC crash immediately?,  Up: Questions and Answers

6.11 When I try to build the package the command `ccache' is not found
======================================================================

I use `ccache' because my machine is so slow... Edit eqc/Makefile.am
and remove it.


File: eqc.info,  Node: The program does not build-,  Next: Autoconf says that the GiNaC library is not present or has a wrong version but that's not true-,  Prev: When I try to build the package the command `ccache' is not found,  Up: Questions and Answers

6.12 The program does not build-
================================

Check that you are using `g++-3.0'. The program will not work with
g++-2.95 or earlier (due to the GiNaC library). You can force the
program to compile with g++-3.0 by setting the environment variable
`CXX' to `g++-3.0' (and `CC' to `gcc-3.0' if necessary).


File: eqc.info,  Node: Autoconf says that the GiNaC library is not present or has a wrong version but that's not true-,  Next: KDevelop throws a fit after I run dpkg-buildpackage or do a configure by hand,  Prev: The program does not build-,  Up: Questions and Answers

6.13 Autoconf says that the GiNaC library is not present or has a wrong version but that's not true-
====================================================================================================

The autoconf macro `AM_PATH_GINAC' might not work correctly on your
system, because it tries to run a program using `ginac/versions.h' with
gcc instead of g++. I had to patch ginac.m4 with `AC_LANG_SAVE',
`AC_LANG_CPLUSPLUS' and `AC_LANG_RESTORE'.

     if test "x$enable_ginactest" = "xyes" ; then
             ac_save_CPPFLAGS="$CPPFLAGS"
             ac_save_LIBS="$LIBS"
             CPPFLAGS="$CPPFLAGS $GINACLIB_CPPFLAGS"
             LIBS="$LIBS $GINACLIB_LIBS"
             rm -f conf.ginactest
             AC_LANG_SAVE
             AC_LANG_CPLUSPLUS
             AC_TRY_RUN([
     include <stdio.h>
     include <string.h>
     include <ginac/version.h>
             ... some more code ...
             return 0;

     ,, no_ginac=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
             AC_LANG_RESTORE
             CPPFLAGS="$ac_save_CPPFLAGS"
             LIBS="$ac_save_LIBS"
     fi

   Note that you have to re-run automake/autoconf for this change to
take effect.


File: eqc.info,  Node: KDevelop throws a fit after I run dpkg-buildpackage or do a configure by hand,  Prev: Autoconf says that the GiNaC library is not present or has a wrong version but that's not true-,  Up: Questions and Answers

6.14 KDevelop throws a fit after I run dpkg-buildpackage or do a configure by hand
==================================================================================

Close KDevelop, remove the target directory (for example, debug). Run
make -f Makefile.cvs and configure and then make distclean and then
hope for the best...


File: eqc.info,  Node: Copyright,  Prev: Questions and Answers,  Up: Top

7 Copyright
***********

EQC Copyright 2002-2006 Jan Rheinlaender,
jrheinlaender@users.sourceforge.net

   This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.

   This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

   You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 675 Mass Ave, Cambridge, MA 02139, USA.



Tag Table:
Node: Top125
Node: Introduction445
Node: Changes1782
Node: Installation11837
Node: How to obtain EQC12192
Node: Requirements12432
Node: Compilation and installation13080
Node: Using EQC with xemacs auctex mode14047
Node: Cross-compiling for Windows15385
Node: Compiling with Cygwin18703
Node: Binary packages20882
Node: Bugs21175
Node: Known bugs21312
Node: Reporting bugs22297
Node: Usage22904
Node: General Usage23147
Node: Physical units25024
Node: Library of substitutions26124
Node: Formatting of floating point numbers26842
Node: Formatting of equations28204
Node: Reference29047
Node: Basic syntax29264
Node: Keywords in the Latex file31617
Node: Keywords for manipulating equations32042
Node: Keywords for manipulating expressions37912
Node: Keywords for defining new units and functions42197
Node: Keywords for printing results44337
Node: Output formatting45520
Node: Other EQC options49535
Node: Miscellaneous49995
Node: Keywords inside equations51166
Node: Command line arguments55557
Node: Examples56227
Node: Questions and Answers56759
Node: Why is the spacing between numbers and units ugly?57733
Node: Why is the spacing between units ugly?58119
Node: Why doesn't substitution of `x^2 = y' work in `1/x^2'?58432
Node: How do I get EQC to accept a variable name like `\varphi''?59038
Node: EQC complains about a wrong number of arguments for a self-defined function59564
Node: EQC does not use my library functions for finding variable values60510
Node: How do I use bibtex with EQC?61211
Node: Why do my equations look ugly?61542
Node: AMS math complains about multiple labels62327
Node: Why does my self-compiled EQC crash immediately?63629
Node: When I try to build the package the command `ccache' is not found64250
Node: The program does not build-64691
Node: Autoconf says that the GiNaC library is not present or has a wrong version but that's not true-65277
Node: KDevelop throws a fit after I run dpkg-buildpackage or do a configure by hand66747
Node: Copyright67310

End Tag Table