CAPD DynSys Library  5.2.0
capd::TexWriter Class Reference

#include <capd/basicalg/TexWriter.h>

Public Types

enum  FloatStyle { FloatSci, FloatFix, FloatFix2, FloatTxt }
 
enum  ImStyle { ImExplicit, ImSymbolii }
 
enum  ExponentStyle { CStyle, TexStyle }
 
enum  VectorStyle { HorizontalVector, CAPDStyle, VerticalVector }
 
enum  EquationStyle { GlobalEquationStyle =-1, NoEquation, InlineEquation, DisplayEquation }
 
enum  PlusSymbolStyle { StandardPlus, ImplicitPlus, NoPlus }
 

Public Member Functions

 TexWriter (std::ostream &output)
 
template<typename T >
putDigits (std::deque< int > &container, int &sign, T number, int n, int precision)
 It parses number and puts its nDigits digits in container. More...
 
void writeSciInterval (const std::deque< int > &dl, const std::deque< int > &dr, int p, int l_sign, int len)
 
void writeFixInterval (const std::deque< int > &dl, const std::deque< int > &dr, int p, int l_sign, int intDigits, int prec)
 
void writeTxtInterval (const std::deque< int > &dl, const std::deque< int > &dr, int p, int l_sign, int intDigits, int prec)
 
template<typename IntervalType >
void writeInterval (const IntervalType &intv)
 
template<typename VectorType >
void writeVector (const VectorType &x)
 
int precision ()
 
TexWriterprecision (int newPrecision)
 
TexWritersetFloatStyle (FloatStyle style)
 
TexWritersetExponentStyle (ExponentStyle i)
 Sets style of a base. More...
 
TexWritersetBaseStyle (int i)
 Sets style of a base. i=0 C convention for exponents e.g 1.0e-5 i=1 TeX e.g. 1.0\cdot 10^{-5}. More...
 
TexWritersetISymbol (ImStyle i)
 Sets style of imaginary symbol i. More...
 
TexWritersetISymbol (int i)
 sets imaginary symbol i. More...
 
TexWritersetVectorStyle (const std::string &start, const std::string &end, const std::string &separator)
 sets vector style More...
 
TexWritersetVectorStyle (const VectorStyle &i)
 sets vector style. More...
 
TexWritersetVectorStyle (int i)
 sets vector style. More...
 
std::string getEquationBeginSymbol (EquationStyle i)
 
std::string getEquationEndSymbol (EquationStyle i)
 
TexWritersetEquationSymbol (EquationStyle i)
 
TexWritersetEquationSymbol (int i)
 
TexWritersetPlusSymbol (int i)
 
template<typename T >
TexWriterwrite (const T &x, EquationStyle equationStyle=GlobalEquationStyle)
 
void writeDocumentHeader (std::string parameters="")
 
void writeDocumentFooter ()
 

Static Public Member Functions

static int numberOfDigits (double n)
 
template<typename Float >
static void computeNumberOfDigitsForInterval (Float &l, Float &r, int prec, FloatStyle style, int &n, int &len, int &exponent)
 For given left and right end of interval and expected precision depending on style chosen it computes needed total number of digits, number of digits before decimal point. More...
 

Public Attributes

FloatStyle floatStyle
 
std::string baseSymbol
 
std::string iSymbol
 
std::string vectorStartSymbol
 
std::string vectorEndSymbol
 
std::string vectorSeparator
 
std::string equationBeginSymbol
 
std::string equationEndSymbol
 
std::string plusSymbol
 

Protected Attributes

std::ostream & out
 

Friends

template<typename T >
TexWriteroperator<< (TexWriter &o, const T &x)
 
TexWriteroperator<< (TexWriter &o, std::ostream &(*fn)(std::ostream &))
 

Member Enumeration Documentation

◆ EquationStyle

Enumerator
GlobalEquationStyle 
NoEquation 
InlineEquation 
DisplayEquation 

◆ ExponentStyle

Enumerator
CStyle 
TexStyle 

◆ FloatStyle

Enumerator
FloatSci 
FloatFix 
FloatFix2 
FloatTxt 

◆ ImStyle

Enumerator
ImExplicit 
ImSymbolii 

◆ PlusSymbolStyle

Enumerator
StandardPlus 
ImplicitPlus 
NoPlus 

◆ VectorStyle

Enumerator
HorizontalVector 
CAPDStyle 
VerticalVector 

Constructor & Destructor Documentation

◆ TexWriter()

capd::TexWriter::TexWriter ( std::ostream &  output)
inline

Member Function Documentation

◆ computeNumberOfDigitsForInterval()

template<typename Float >
void capd::TexWriter::computeNumberOfDigitsForInterval ( Float &  leftEnd,
Float &  rightEnd,
int  precision,
FloatStyle  style,
int numberOfDecDigits,
int totalNumberOfDigits,
int exponent 
)
static

For given left and right end of interval and expected precision depending on style chosen it computes needed total number of digits, number of digits before decimal point.

Additionally for FloatSci style it returns common exponent and changes endpoints so that at least one of them is in the form 1.xxxxxx... (second can be 0.00xxxx)

◆ getEquationBeginSymbol()

std::string capd::TexWriter::getEquationBeginSymbol ( EquationStyle  i)
inline

◆ getEquationEndSymbol()

std::string capd::TexWriter::getEquationEndSymbol ( EquationStyle  i)
inline

◆ numberOfDigits()

static int capd::TexWriter::numberOfDigits ( double  n)
inlinestatic

◆ precision() [1/2]

int capd::TexWriter::precision ( )
inline

◆ precision() [2/2]

TexWriter& capd::TexWriter::precision ( int  newPrecision)
inline

◆ putDigits()

template<typename T >
T capd::TexWriter::putDigits ( std::deque< int > &  container,
int sign,
number,
int  nDecDigits,
int  nDigits 
)

It parses number and puts its nDigits digits in container.

Returns
part of number that remained after parsing
Parameters
[out]container[out] container where digits will be stored
[out]sign[out] returns sign of number
[in]number[in] number to be parsed
[in]nDecDigits[in] number of decimal digits (before decimal point) of a given number to be stored in container
[in]nDigits[in] total number of digits to be stored in container

◆ setBaseStyle()

TexWriter& capd::TexWriter::setBaseStyle ( int  i)
inline

Sets style of a base. i=0 C convention for exponents e.g 1.0e-5 i=1 TeX e.g. 1.0\cdot 10^{-5}.

◆ setEquationSymbol() [1/2]

TexWriter& capd::TexWriter::setEquationSymbol ( EquationStyle  i)
inline

◆ setEquationSymbol() [2/2]

TexWriter& capd::TexWriter::setEquationSymbol ( int  i)
inline

◆ setExponentStyle()

TexWriter& capd::TexWriter::setExponentStyle ( ExponentStyle  i)
inline

Sets style of a base.

◆ setFloatStyle()

TexWriter& capd::TexWriter::setFloatStyle ( FloatStyle  style)
inline

◆ setISymbol() [1/2]

TexWriter& capd::TexWriter::setISymbol ( ImStyle  i)
inline

Sets style of imaginary symbol i.

◆ setISymbol() [2/2]

TexWriter& capd::TexWriter::setISymbol ( int  i)
inline

sets imaginary symbol i.

◆ setPlusSymbol()

TexWriter& capd::TexWriter::setPlusSymbol ( int  i)
inline

◆ setVectorStyle() [1/3]

TexWriter& capd::TexWriter::setVectorStyle ( const std::string &  start,
const std::string &  end,
const std::string &  separator 
)
inline

sets vector style

◆ setVectorStyle() [2/3]

TexWriter& capd::TexWriter::setVectorStyle ( const VectorStyle i)
inline

sets vector style.

◆ setVectorStyle() [3/3]

TexWriter& capd::TexWriter::setVectorStyle ( int  i)
inline

sets vector style.

  • i=0 sequence : (1, 3, 4)
  • i=1 CAPD vectors : {1, 3, 4}
  • i=2 vertical vector

◆ write()

template<typename T >
TexWriter & capd::TexWriter::write ( const T &  x,
EquationStyle  equationStyle = GlobalEquationStyle 
)

◆ writeDocumentFooter()

void capd::TexWriter::writeDocumentFooter ( )
inline

◆ writeDocumentHeader()

void capd::TexWriter::writeDocumentHeader ( std::string  parameters = "")
inline

◆ writeFixInterval()

void capd::TexWriter::writeFixInterval ( const std::deque< int > &  dl,
const std::deque< int > &  dr,
int  p,
int  l_sign,
int  intDigits,
int  prec 
)

◆ writeInterval()

template<typename IntervalType >
void capd::TexWriter::writeInterval ( const IntervalType &  intv)

◆ writeSciInterval()

void capd::TexWriter::writeSciInterval ( const std::deque< int > &  dl,
const std::deque< int > &  dr,
int  p,
int  l_sign,
int  len 
)

◆ writeTxtInterval()

void capd::TexWriter::writeTxtInterval ( const std::deque< int > &  dl,
const std::deque< int > &  dr,
int  p,
int  l_sign,
int  intDigits,
int  prec 
)

◆ writeVector()

template<typename VectorType >
void capd::TexWriter::writeVector ( const VectorType &  x)

Friends And Related Function Documentation

◆ operator<< [1/2]

template<typename T >
TexWriter& operator<< ( TexWriter o,
const T &  x 
)
friend

◆ operator<< [2/2]

TexWriter& operator<< ( TexWriter o,
std::ostream &(*)(std::ostream &)  fn 
)
friend

Member Data Documentation

◆ baseSymbol

std::string capd::TexWriter::baseSymbol

◆ equationBeginSymbol

std::string capd::TexWriter::equationBeginSymbol

◆ equationEndSymbol

std::string capd::TexWriter::equationEndSymbol

◆ floatStyle

FloatStyle capd::TexWriter::floatStyle

◆ iSymbol

std::string capd::TexWriter::iSymbol

◆ out

std::ostream& capd::TexWriter::out
protected

◆ plusSymbol

std::string capd::TexWriter::plusSymbol

◆ vectorEndSymbol

std::string capd::TexWriter::vectorEndSymbol

◆ vectorSeparator

std::string capd::TexWriter::vectorSeparator

◆ vectorStartSymbol

std::string capd::TexWriter::vectorStartSymbol