]> www.ginac.de Git - ginac.git/commitdiff
Introducing method symbol::get_TeX_name() to match existing symbol::get_name().
authorVladimir V. Kisil <kisilv@maths.leeds.ac.uk>
Mon, 17 Jul 2017 07:37:21 +0000 (09:37 +0200)
committerRichard Kreckel <kreckel@ginac.de>
Mon, 17 Jul 2017 07:37:21 +0000 (09:37 +0200)
Signed-off-by: Vladimir V. Kisil <kisilv@maths.leeds.ac.uk>
doc/tutorial/ginac.texi
ginac/symbol.cpp
ginac/symbol.h

index d5dbdd14b49acdc1b3107504b78f7f1ecd95fa0f..03365d0584719dec019839f802057f57e424f4a2 100644 (file)
@@ -1146,7 +1146,14 @@ This creates a symbol that is printed as "@code{x}" in normal output, but
 as "@code{\Box}" in LaTeX code (@xref{Input/output}, for more
 information about the different output formats of expressions in GiNaC).
 GiNaC automatically creates proper LaTeX code for symbols having names of
-greek letters (@samp{alpha}, @samp{mu}, etc.).
+greek letters (@samp{alpha}, @samp{mu}, etc.). You can retrive the name
+and the LaTeX name of a symbol using the respective methods:
+@cindex @code{get_name()}
+@cindex @code{get_TeX_name()}
+@example
+symbol::get_name() const;
+symbol::get_TeX_name() const;
+@end example
 
 @cindex @code{subs()}
 Symbols in GiNaC can't be assigned values. If you need to store results of
index 879461a4522beb04279cda5a5da76b3838953d05..c1256d56eb8adcb256d63ac122cd2aeb82c90b61 100644 (file)
@@ -157,6 +157,14 @@ std::string symbol::get_name() const
        return name;
 }
 
+std::string symbol::get_TeX_name() const
+{
+       if (TeX_name.empty()) {
+               return get_default_TeX_name(get_name());
+       }
+       return TeX_name;
+}
+
 // protected
 
 void symbol::do_print(const print_context & c, unsigned level) const
index 91a9982a0c3a20519e244dfe65e8e1e5fa33eebc..1b9d3f8be2d57101d5a78be257a2f99a38d233c4 100644 (file)
@@ -75,6 +75,7 @@ public:
        void set_name(const std::string & n) { name = n; }
        void set_TeX_name(const std::string & n) { TeX_name = n; }
        std::string get_name() const;
+       std::string get_TeX_name() const;
 protected:
        void do_print(const print_context & c, unsigned level) const;
        void do_print_latex(const print_latex & c, unsigned level) const;