Support tabular-star specs, escapes, and SIVP math commands
This commit is contained in:
1 parent
c1a7dedd6a
commit
3be8cefe46
4 files changed
+33
-4
No files matched your search
@@ -2044,7 +2044,7 @@ impl Parser {
|
||||
self.flush_paragraph();
|
||||
self.finish_list();
|
||||
}
|
||||
(true, "tabular") | (true, "longtable") => {
|
||||
(true, "tabular") | (true, "tabular*") | (true, "longtable") => {
|
||||
self.flush_paragraph();
|
||||
self.finish_list();
|
||||
self.table = Some(TableBuilder {
|
||||
@@ -2056,7 +2056,7 @@ impl Parser {
|
||||
self.current_reference = self.table_number.to_string();
|
||||
}
|
||||
}
|
||||
(false, "tabular") | (false, "longtable") => self.finish_table(),
|
||||
(false, "tabular") | (false, "tabular*") | (false, "longtable") => self.finish_table(),
|
||||
(true, "figure") => {
|
||||
self.flush_paragraph();
|
||||
self.float_placement = String::new();
|
||||
|
||||
@@ -83,6 +83,8 @@ const PRELUDE: &str = r#"
|
||||
\def\bottomrule{\texrratablerule}
|
||||
\def\&{\texrraampersand}
|
||||
\def\%{\char37}
|
||||
\def\#{\char35}
|
||||
\def\${\char36}
|
||||
\def\thetable{1}
|
||||
\def\thefigure{1}
|
||||
\def\arabic#1{0}
|
||||
@@ -141,6 +143,8 @@ const PRELUDE: &str = r#"
|
||||
\def\max{\mathop{\mathrm{max}}}
|
||||
|
||||
|
||||
\def\balance{}
|
||||
\def\noalign#1{}
|
||||
\def\resizebox#1#2#3{#3}
|
||||
\def\scalebox#1#2{#2}
|
||||
\def\rotatebox#1#2{#2}
|
||||
|
||||
@@ -1534,7 +1534,9 @@ impl vm::Handlers<CompilerState> for OutputHandlers {
|
||||
.current()
|
||||
.map(str::to_owned);
|
||||
let event = match environment.as_deref() {
|
||||
Some("tabular") | Some("longtable") => FrontendEventKind::TableCell,
|
||||
Some("tabular") | Some("tabular*") | Some("longtable") => {
|
||||
FrontendEventKind::TableCell
|
||||
}
|
||||
Some(environment) if is_math_alignment_environment(environment) => {
|
||||
FrontendEventKind::MathCell
|
||||
}
|
||||
@@ -6211,7 +6213,15 @@ fn begin_environment_primitive(
|
||||
input.as_mut().expansions_mut().push(flush);
|
||||
}
|
||||
}
|
||||
let argument = if matches!(
|
||||
let argument = if name == "tabular*" {
|
||||
let _width = read_scanned_token_list(input)?;
|
||||
Some(
|
||||
read_scanned_token_list(input)?
|
||||
.into_iter()
|
||||
.filter_map(|token| token.char())
|
||||
.collect::<String>(),
|
||||
)
|
||||
} else if matches!(
|
||||
name.as_str(),
|
||||
"array" | "tabular" | "longtable" | "alignedat" | "alignat" | "alignat*"
|
||||
) {
|
||||
|
||||
@@ -1725,3 +1725,18 @@ fn nested_newif_conditionals_skip_correctly() {
|
||||
assert!(!svg.contains("OUTER-TRUE"));
|
||||
assert!(!svg.contains(">INNER-F</text>"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tabular_star_column_spec_ignores_extracolsep() {
|
||||
let source = r"\documentclass{article}
|
||||
\begin{document}
|
||||
\begin{tabular*}{\textwidth}{@{}@{\extracolsep{\fill}}lllll@{}}
|
||||
Name & Description & Size & Note & Extra \\
|
||||
Dendrite & Input terminal & 100 & a & b \\
|
||||
\end{tabular*}
|
||||
\end{document}";
|
||||
let value = fresh_preview(source, "tabular-star.tex");
|
||||
assert_eq!(value["status"], "ok");
|
||||
let svg = page_svg(&value, 0);
|
||||
assert!(svg.contains(">Dendrite</text>"));
|
||||
}
|
||||
Reference in new issue
Block a user