public static function Appendix($title, $level = 0) { static $first = array('A', 1, 'a'); static $place = array('A', 1, 'a'); static $h = array('h3', 'h4', 'h5'); static $incr = false; static $last = 0; if (Paper::Div($title, $level)) { return; } assert($level >= -2 && $level <= 2, "Levels must be in range 0-2."); $diff = $level - $last; assert($diff <= 1, "Levels may only increase by 1."); if ($incr) { $place[$level]++; } $incr = true; if ($last < $level) { $place[$level] = $first[$level]; } $last = $level; $b = '<' . $h[$level] . '>Appendix '; $a = '</' . $h[$level] . '>'; echo "{$b}" . implode('.', array_slice($place, 0, $level + 1)) . ": {$title}{$a}"; echo PHP_EOL; }