octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How do you define a new texinfo macro?


From: John W. Eaton
Subject: How do you define a new texinfo macro?
Date: Wed, 9 May 2012 11:16:37 -0400

On  9-May-2012, John W. Eaton wrote:

| On  9-May-2012, Jordi Gutiérrez Hermoso wrote:
| 
| | We have a tiny problem with the docstring for mldivide and ldivide.
| | It's using backslashes in a the xcode macro, and texinfo has problems
| | with that:
| | 
| |     http://old.nabble.com/backslashes-in-macro-arguments-td28884883.html
| | 
| | A suggested workaround is to define a new macro just for backslashes
| | instead of passing backslashes as macro arguments. I was unable to
| | figure out how to do this. I tried monkeying the xcode macro, but I
| | was unable to make it work, so I thought I'd just ask.
| 
| You mean the @address@hidden \\ y}} part of the docstring?
| 
| Hmm, when I do "help mldivide", the backslash from that shows up but
| when I look at the Info version of the manual with "doc mldivide" it
| does not.  That's odd, since both are supposed to be processed with
| makeinfo.

Oh, I see the difference now is probably due to mk_doc_cache.m
stripping out our user-defined macros before passing the text to
makeinfo.  So maybe something like the attached patch will work?

But it seems it would be better for these macros to go in a separate
file instead of in octave.texi and then to pass those through makeinfo
along with the docstring source.  Otherwise the definitions used for
the doc cache and the Info version of the manual could easily diverge.

jwe

diff --git a/doc/interpreter/mk_doc_cache.m b/doc/interpreter/mk_doc_cache.m
--- a/doc/interpreter/mk_doc_cache.m
+++ b/doc/interpreter/mk_doc_cache.m
@@ -49,6 +49,7 @@
 text = regexprep (text, '@seealso *\{([^}]*)\}', "See also: $1.");
 text = regexprep (text, '@nospell *\{([^}]*)\}', "$1");
 text = regexprep (text, '@xcode *\{([^}]*)\}', "$1");
+text = regexprep (text, '@bullshit *\{([^}]*)\}', "\\");
 text = strrep (text, '@', "@@");
 
 ## Write data to temporary file for input to makeinfo
diff --git a/doc/interpreter/octave.texi b/doc/interpreter/octave.texi
--- a/doc/interpreter/octave.texi
+++ b/doc/interpreter/octave.texi
@@ -46,6 +46,10 @@
 \arg\
 @end macro
 
address@hidden bullshit
+\\
address@hidden macro
+
 @c The following macro works around a situation where the Info/plain text
 @c expansion of the @code{XXX} macro is `XXX'.  The use of the apostrophe
 @c can be confusing if the code segment itself ends with a transpose operator.
diff --git a/src/data.cc b/src/data.cc
--- a/src/data.cc
+++ b/src/data.cc
@@ -5477,7 +5477,7 @@
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} mldivide (@var{x}, @var{y})\n\
 Return the matrix left division of @var{x} and @var{y}.\n\
-This function and @address@hidden \\ y}} are equivalent.\n\
+This function and @address@hidden @bullshit{} y}} are equivalent.\n\
 @seealso{mrdivide, ldivide}\n\
 @end deftypefn")
 {

reply via email to

[Prev in Thread] Current Thread [Next in Thread]