4.1 TexInfo Macros

ANVL provides a small TexInfo library with various helper macros. Its location is returned by anvl_texinfo_erlang:includes_dir/0 function. To use it do the following:

  1. Add include directory to the project by setting texinfo/include_dirs in anvl.erl:
    conf() ->
      #{ [texinfo, include_dirs] => [anvl_texinfo_erlang:includes_dir(), ...]
       }.
    
  2. Include the necessary files in the top-level TexInfo document:
    @include anvl_erlang.texi
    

This file provides the following macros that can be used to create cross-references to the automatically-generated Erlang documentation:

All of them have the same arguments (using erlfn as an example):

@erlfn{OUTER, INNER, MODULE, NAME, ARITY}

Semantics of MODULE, NAME and ARITY arguments should be pretty self-explanatory. OUTER argument can be set to either xref, pxref, ref or link. The macro will expand into the corresponding TexInfo cross-reference command.

INNER argument controls how to render the label for the online output. It can be one of the following:

  1. erlref is rendered as MODULE:NAME/ARITY in LaTeX and HTML outputs or (due to the limitations of the format) as MODULE/NAME/ARITY in GNU info files.

    For example, @erlfn{pxref,erlref,anvl_condition,precondition,1} becomes “see anvl_condition:precondition/1”.

  2. erlcall is rendered as MODULE:NAME. It is used to make links inside the code blocks. For example,
        foo() ->
              @erlfn{link,erlcall,anvl_condition,precondition,1}(bar()).
        

    becomes

        foo() ->
              anvl_condition:precondition(bar()).
        
  3. erllcall (where l stands for “local”) is very similar to erlcall, but it omits the module name. It is used to refer to local and imported functions. For example,
        foo() ->
              @erlfn{link,erllcall,anvl_condition,precondition,1}(bar()).
        

    becomes

        foo() ->
              precondition(bar()).
        

Finally, there is erlmodref macro used to cross-reference an entire Erlang module. It takes just two arguments: OUTER and MODULE. Their semantics is the same as the above.

For example, @erlmodref{pxref,anvl_condition} becomes “see anvl_condition”.


JavaScript license information