1 #ifndef VCSN_ALGOS_TIKZ_HH
2 # define VCSN_ALGOS_TIKZ_HH
6 # include <unordered_map>
7 # include <unordered_set>
26 template <
typename Aut>
41 using super_t::super_t;
51 if (
ws_.show_one() || !
ws_.is_one(w))
53 os_ <<
',' << kind <<
" text=$\\left\\langle ";
54 ws_.print(w,
os_,
"latex") <<
"\\right\\rangle$";
62 "\\documentclass{standalone}\n"
63 " \\usepackage{tikz}\n"
64 " \\usetikzlibrary{arrows.meta, automata, bend,"
65 " positioning, shapes.misc}\n"
66 " \\tikzstyle{automaton}=[shorten >=1pt,"
67 " >={Stealth[bend,round]}, initial text=]\n"
68 " \\tikzstyle{accepting}=[accepting by arrow]\n"
71 "\\begin{tikzpicture}[automaton, auto]\n"
75 for (
auto s :
aut_->states())
77 os_ <<
" \\node[state";
80 if (
aut_->state_has_name(s))
81 os_ <<
",rounded rectangle";
85 if (prev !=
aut_->null_state())
92 aut_->print_state_name(s,
os_,
"latex");
97 for (
auto src :
aut_->states())
100 for (
auto t:
aut_->out(src))
101 ds.insert(
aut_->dst_of(t));
104 os_ <<
" \\path[->] (";
107 << (src == dst ?
"[loop above]" :
"")
117 "\\end{tikzpicture}\n"
126 template <
typename AutPtr>
128 tikz(
const AutPtr& aut, std::ostream& out)
140 template <
typename Aut,
typename Ostream>
143 return tikz(aut->as<Aut>(), out);
147 (
const automaton& aut, std::ostream& out) -> std::ostream&);
152 #endif // !VCSN_ALGOS_TIKZ_HH
REGISTER_DECLARE(accessible,(const automaton &) -> automaton)
std::shared_ptr< detail::automaton_base > automaton
std::ostream & print_entry_(state_t src, state_t dst, std::ostream &os, const std::string &fmt="text")
The labels and weights of transitions from src to dst.
const weightset_t & ws_
Short-hand to the weightset.
weight_t_of< automaton_t > weight_t
std::ostream & tikz(const AutPtr &aut, std::ostream &out)
Print automaton to TikZ format.
std::ostream & os_
Output stream.
transition_t_of< automaton_t > transition_t
Factor common bits in automaton formatting.
std::ostream & tikz(const automaton &aut, std::ostream &out)
Bridge.
Format automaton to TikZ format.
const automaton_t & aut_
The automaton we have to output.
state_t_of< automaton_t > state_t
void print_finitial_(const std::string &kind, const weight_t &w)
Format an initial/final weight.