diff --git a/CHANGELOG.md b/CHANGELOG.md index d669e4a..04fa022 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- **Breaking** Footnotes are by default separated with linebreaks now. This can be changed by setting the new `Table` option `linebreak_footnotes = false` [#34](https://github.com/PumasAI/SummaryTables.jl/pull/34). - **Breaking** Changed `show_overall` keyword of `table_one` to `show_total`. The name of all total columns was changed from `"Overall"` to `"Total"` as well but this can be changed using the new `total_name` keyword. - Added ability to show "Total" statistics for subgroups in `table_one` [#30](https://github.com/PumasAI/SummaryTables.jl/pull/30). - Fixed tagging of header rows in docx output, such that the header section is now repeated across pages as expected [#32](https://github.com/PumasAI/SummaryTables.jl/pull/32). diff --git a/README_files/figure-commonmark/cell-5-output-1.svg b/README_files/figure-commonmark/cell-5-output-1.svg index 40d99f6..ab4f6c4 100644 --- a/README_files/figure-commonmark/cell-5-output-1.svg +++ b/README_files/figure-commonmark/cell-5-output-1.svg @@ -1,7 +1,7 @@ - + - + @@ -300,26 +300,22 @@ - + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -508,7 +504,7 @@ - + diff --git a/src/cells.jl b/src/cells.jl index c0395b3..39a7294 100644 --- a/src/cells.jl +++ b/src/cells.jl @@ -111,6 +111,7 @@ struct Table round_digits::Int round_mode::Union{Nothing,Symbol} trailing_zeros::Bool + linebreak_footnotes::Bool end function Table(cells, header, footer; @@ -121,8 +122,9 @@ function Table(cells, header, footer; postprocess = [], rowgaps = Pair{Int,Float64}[], colgaps = Pair{Int,Float64}[], + linebreak_footnotes::Bool = true, ) - Table(cells, header, footer, footnotes, rowgaps, colgaps, postprocess, round_digits, round_mode, trailing_zeros) + Table(cells, header, footer, footnotes, rowgaps, colgaps, postprocess, round_digits, round_mode, trailing_zeros, linebreak_footnotes) end """ @@ -136,6 +138,7 @@ end postprocess = [], rowgaps = Pair{Int,Float64}[], colgaps = Pair{Int,Float64}[], + linebreak_footnotes = true, ) Create a `Table` which can be rendered in multiple formats, such as HTML or LaTeX. @@ -160,6 +163,7 @@ Create a `Table` which can be rendered in multiple formats, such as HTML or LaTe the size of `gap_pt` is added between the rows `index` and `index+1`. - `colgaps = Pair{Int,Float64}[]`: A list of pairs `index => gap_pt`. For each pair, a visual gap the size of `gap_pt` is added between the columns `index` and `index+1`. +- `linebreak_footnotes = true`: If `true`, each footnote and annotation starts on a separate line. ## Round mode @@ -465,7 +469,7 @@ function postprocess_table(ct::Table, any) end return new_cell end - Table(new_cl, ct.header, ct.footer, ct.footnotes, ct.rowgaps, ct.colgaps, [], ct.round_digits, ct.round_mode, ct.trailing_zeros) + Table(new_cl, ct.header, ct.footer, ct.footnotes, ct.rowgaps, ct.colgaps, [], ct.round_digits, ct.round_mode, ct.trailing_zeros, ct.linebreak_footnotes) end function postprocess_table(ct::Table, v::AbstractVector) diff --git a/src/docx.jl b/src/docx.jl index 2b15775..b8ba892 100644 --- a/src/docx.jl +++ b/src/docx.jl @@ -80,10 +80,12 @@ function to_docx(ct::Table) push!(tablerows, full_width_border_row(DOCX_OUTER_RULE_SIZE)) + separator_element = ct.linebreak_footnotes ? WriteDocx.Break() : WriteDocx.Text(" ") + if !isempty(annotations) || !isempty(ct.footnotes) elements = [] for (i, (annotation, label)) in enumerate(annotations) - i > 1 && push!(elements, WriteDocx.Run([WriteDocx.Text(" ")])) + i > 1 && push!(elements, WriteDocx.Run([separator_element])) if label !== NoLabel() push!(elements, WriteDocx.Run([WriteDocx.Text(docx_sprint(label)), WriteDocx.Text(" ")], WriteDocx.RunProperties(valign = WriteDocx.VerticalAlignment.superscript))) @@ -92,7 +94,7 @@ function to_docx(ct::Table) WriteDocx.RunProperties(size = DOCX_ANNOTATION_FONTSIZE))) end for (i, footnote) in enumerate(ct.footnotes) - (!isempty(annotations) || i > 1) && push!(elements, WriteDocx.Run([WriteDocx.Text(" ")])) + (!isempty(annotations) || i > 1) && push!(elements, WriteDocx.Run([separator_element])) push!(elements, WriteDocx.Run([WriteDocx.Text(docx_sprint(footnote))], WriteDocx.RunProperties(size = DOCX_ANNOTATION_FONTSIZE))) end diff --git a/src/html.jl b/src/html.jl index 97699db..d28c83c 100644 --- a/src/html.jl +++ b/src/html.jl @@ -90,7 +90,13 @@ function Base.show(io::IO, ::MIME"text/html", ct::Table) if !isempty(annotations) || !isempty(ct.footnotes) print(_io, "
") for (i, (annotation, label)) in enumerate(annotations) - i > 1 && print(_io, "    ") + if i > 1 + if ct.linebreak_footnotes + print(_io, "

") + else + print(_io, "    ") + end + end if label !== NoLabel() print(_io, "") _showas(_io, MIME"text/html"(), label) @@ -99,7 +105,13 @@ function Base.show(io::IO, ::MIME"text/html", ct::Table) _showas(_io, MIME"text/html"(), annotation) end for (i, footnote) in enumerate(ct.footnotes) - (!isempty(annotations) || i > 1) && print(_io, "    ") + if !isempty(annotations) || i > 1 + if ct.linebreak_footnotes + print(_io, "
") + else + print(_io, "    ") + end + end _showas(_io, MIME"text/html"(), footnote) end println(_io, "") diff --git a/src/latex.jl b/src/latex.jl index 9347bd1..be48f2e 100644 --- a/src/latex.jl +++ b/src/latex.jl @@ -118,13 +118,15 @@ function Base.show(io::IO, ::MIME"text/latex", ct::Table) \end{tabular} """) if !isempty(annotations) || !isempty(ct.footnotes) - println(io, raw"\begin{tablenotes}[flushleft,para]") + println(io, "\\begin{tablenotes}[flushleft$(ct.linebreak_footnotes ? "" : ",para")]") println(io, raw"\footnotesize") for (annotation, label) in annotations if label !== NoLabel() print(io, raw"\item[") _showas(io, MIME"text/latex"(), label) print(io, "]") + else + print(io, raw"\item[]") end _showas(io, MIME"text/latex"(), annotation) println(io) diff --git a/src/typst.jl b/src/typst.jl index fd47af2..0be41d5 100644 --- a/src/typst.jl +++ b/src/typst.jl @@ -91,26 +91,32 @@ function Base.show(io::IO, M::MIME"text/typst", ct::Table) align = _align(CellStyle(halign = :left), 1) colspan = "colspan: $(size(matrix, 2))" options = join(filter(!isempty, [align, colspan]), ", ") - print(io, " table.cell($options)[") + print(io, " table.cell($options)[#text(size: 0.8em)[") + + if (!isempty(annotations) || !isempty(ct.footnotes)) && ct.linebreak_footnotes + print(io, "\n ") + end for (i, (annotation, label)) in enumerate(annotations) - i > 1 && print(io, "#h(1.5em, weak: true)") + i > 1 && print(io, ct.linebreak_footnotes ? "\\\n " : "#h(1.5em, weak: true)") if label !== NoLabel() print(io, "#super[") _showas(io, MIME"text/typst"(), label) print(io, "]") end - print(io, "#text(size: 0.8em)[") _showas(io, MIME"text/typst"(), annotation) - print(io, "]") end for (i, footnote) in enumerate(ct.footnotes) - (!isempty(annotations) || i > 1) && print(io, "#h(1.5em, weak: true)") + (!isempty(annotations) || i > 1) && print(io, ct.linebreak_footnotes ? "\\\n " : "#h(1.5em, weak: true)") _showas(io, MIME"text/typst"(), footnote) end - println(io, "],") # table.cell()[ + if (!isempty(annotations) || !isempty(ct.footnotes)) && ct.linebreak_footnotes + print(io, "\n ") + end + + println(io, "]],") # table.cell()[#text(..)[ end println(io, ")") # table() diff --git a/test/references/annotations/annotated_float.latex.txt b/test/references/annotations/annotated_float.latex.txt index 4310bfd..634a875 100644 --- a/test/references/annotations/annotated_float.latex.txt +++ b/test/references/annotations/annotated_float.latex.txt @@ -12,7 +12,7 @@ 0.124\tnote{A} \\ \bottomrule \end{tabular} -\begin{tablenotes}[flushleft,para] +\begin{tablenotes}[flushleft] \footnotesize \item[A]Note 1 \end{tablenotes} diff --git a/test/references/annotations/annotated_float.typ.txt b/test/references/annotations/annotated_float.typ.txt index 971a818..b0a5ae9 100644 --- a/test/references/annotations/annotated_float.typ.txt +++ b/test/references/annotations/annotated_float.typ.txt @@ -8,5 +8,7 @@ table.hline(y: 0, stroke: 1pt), [0.124#super[A]], table.hline(y: 1, stroke: 1pt), - table.cell(align: left, colspan: 1)[#super[A]#text(size: 0.8em)[Note 1]], + table.cell(align: left, colspan: 1)[#text(size: 0.8em)[ + #super[A]Note 1 + ]], ) diff --git a/test/references/annotations/automatic_annotations.docx.txt b/test/references/annotations/automatic_annotations.docx.txt index 897c02a..58f4d56 100644 --- a/test/references/annotations/automatic_annotations.docx.txt +++ b/test/references/annotations/automatic_annotations.docx.txt @@ -326,7 +326,7 @@ - + @@ -343,7 +343,7 @@ - + diff --git a/test/references/annotations/automatic_annotations.latex.txt b/test/references/annotations/automatic_annotations.latex.txt index aa70845..d5bd599 100644 --- a/test/references/annotations/automatic_annotations.latex.txt +++ b/test/references/annotations/automatic_annotations.latex.txt @@ -13,7 +13,7 @@ A\tnote{1} & B\tnote{2} \\ C\tnote{3} & D\tnote{1} \\ \bottomrule \end{tabular} -\begin{tablenotes}[flushleft,para] +\begin{tablenotes}[flushleft] \footnotesize \item[1]Note 1 \item[2]Note 2 diff --git a/test/references/annotations/automatic_annotations.txt b/test/references/annotations/automatic_annotations.txt index 8001c2d..0214793 100644 --- a/test/references/annotations/automatic_annotations.txt +++ b/test/references/annotations/automatic_annotations.txt @@ -1,6 +1,6 @@ - +
@@ -38,5 +38,5 @@ - +
D1
1 Note 1    2 Note 2    3 Note 3
1 Note 1
2 Note 2
3 Note 3
\ No newline at end of file diff --git a/test/references/annotations/automatic_annotations.typ.txt b/test/references/annotations/automatic_annotations.typ.txt index a2cdf43..0eb3ff2 100644 --- a/test/references/annotations/automatic_annotations.typ.txt +++ b/test/references/annotations/automatic_annotations.typ.txt @@ -11,5 +11,9 @@ [C#super[3]], [D#super[1]], table.hline(y: 2, stroke: 1pt), - table.cell(align: left, colspan: 2)[#super[1]#text(size: 0.8em)[Note 1]#h(1.5em, weak: true)#super[2]#text(size: 0.8em)[Note 2]#h(1.5em, weak: true)#super[3]#text(size: 0.8em)[Note 3]], + table.cell(align: left, colspan: 2)[#text(size: 0.8em)[ + #super[1]Note 1\ + #super[2]Note 2\ + #super[3]Note 3 + ]], ) diff --git a/test/references/annotations/manual_annotations.docx.txt b/test/references/annotations/manual_annotations.docx.txt index 1935603..74a3124 100644 --- a/test/references/annotations/manual_annotations.docx.txt +++ b/test/references/annotations/manual_annotations.docx.txt @@ -326,7 +326,7 @@
- + @@ -343,7 +343,7 @@ - + @@ -360,7 +360,7 @@ - + diff --git a/test/references/annotations/manual_annotations.latex.txt b/test/references/annotations/manual_annotations.latex.txt index 57aeebd..28f5a57 100644 --- a/test/references/annotations/manual_annotations.latex.txt +++ b/test/references/annotations/manual_annotations.latex.txt @@ -13,7 +13,7 @@ A\tnote{X} & B\tnote{Y} \\ C\tnote{1} & D\tnote{2} \\ \bottomrule \end{tabular} -\begin{tablenotes}[flushleft,para] +\begin{tablenotes}[flushleft] \footnotesize \item[1]Note 3 \item[2]Note 4 diff --git a/test/references/annotations/manual_annotations.txt b/test/references/annotations/manual_annotations.txt index f7ed7a5..4c36fa7 100644 --- a/test/references/annotations/manual_annotations.txt +++ b/test/references/annotations/manual_annotations.txt @@ -1,6 +1,6 @@ - +
@@ -38,5 +38,5 @@ - +
D2
1 Note 3    2 Note 4    X Note 1    Y Note 2
1 Note 3
2 Note 4
X Note 1
Y Note 2
\ No newline at end of file diff --git a/test/references/annotations/manual_annotations.typ.txt b/test/references/annotations/manual_annotations.typ.txt index 9c69685..2f0da34 100644 --- a/test/references/annotations/manual_annotations.typ.txt +++ b/test/references/annotations/manual_annotations.typ.txt @@ -11,5 +11,10 @@ [C#super[1]], [D#super[2]], table.hline(y: 2, stroke: 1pt), - table.cell(align: left, colspan: 2)[#super[1]#text(size: 0.8em)[Note 3]#h(1.5em, weak: true)#super[2]#text(size: 0.8em)[Note 4]#h(1.5em, weak: true)#super[X]#text(size: 0.8em)[Note 1]#h(1.5em, weak: true)#super[Y]#text(size: 0.8em)[Note 2]], + table.cell(align: left, colspan: 2)[#text(size: 0.8em)[ + #super[1]Note 3\ + #super[2]Note 4\ + #super[X]Note 1\ + #super[Y]Note 2 + ]], ) diff --git a/test/references/manual_footnotes/footnotes_and_annotated.docx.txt b/test/references/manual_footnotes/footnotes_and_annotated_linebreaks_false.docx.txt similarity index 100% rename from test/references/manual_footnotes/footnotes_and_annotated.docx.txt rename to test/references/manual_footnotes/footnotes_and_annotated_linebreaks_false.docx.txt diff --git a/test/references/manual_footnotes/footnotes_and_annotated.latex.txt b/test/references/manual_footnotes/footnotes_and_annotated_linebreaks_false.latex.txt similarity index 100% rename from test/references/manual_footnotes/footnotes_and_annotated.latex.txt rename to test/references/manual_footnotes/footnotes_and_annotated_linebreaks_false.latex.txt diff --git a/test/references/manual_footnotes/footnotes_and_annotated.txt b/test/references/manual_footnotes/footnotes_and_annotated_linebreaks_false.txt similarity index 100% rename from test/references/manual_footnotes/footnotes_and_annotated.txt rename to test/references/manual_footnotes/footnotes_and_annotated_linebreaks_false.txt diff --git a/test/references/manual_footnotes/footnotes_and_annotated.typ.txt b/test/references/manual_footnotes/footnotes_and_annotated_linebreaks_false.typ.txt similarity index 59% rename from test/references/manual_footnotes/footnotes_and_annotated.typ.txt rename to test/references/manual_footnotes/footnotes_and_annotated_linebreaks_false.typ.txt index ba2678e..779b58d 100644 --- a/test/references/manual_footnotes/footnotes_and_annotated.typ.txt +++ b/test/references/manual_footnotes/footnotes_and_annotated_linebreaks_false.typ.txt @@ -9,5 +9,5 @@ [Cell 1#super[1]], [Cell 2], table.hline(y: 1, stroke: 1pt), - table.cell(align: left, colspan: 2)[#super[1]#text(size: 0.8em)[Note 1]#h(1.5em, weak: true)First footnote.#h(1.5em, weak: true)Second footnote.], + table.cell(align: left, colspan: 2)[#text(size: 0.8em)[#super[1]Note 1#h(1.5em, weak: true)First footnote.#h(1.5em, weak: true)Second footnote.]], ) diff --git a/test/references/manual_footnotes/footnotes_and_annotated_linebreaks_true.docx.txt b/test/references/manual_footnotes/footnotes_and_annotated_linebreaks_true.docx.txt new file mode 100644 index 0000000..d09dcec --- /dev/null +++ b/test/references/manual_footnotes/footnotes_and_annotated_linebreaks_true.docx.txt @@ -0,0 +1,302 @@ +############################## [Content_Types].xml ############################## + + + + + + + + + +############################## _rels/.rels ############################## + + + + +############################## word/_rels/document.xml.rels ############################## + + + + +############################## word/styles.xml ############################## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +############################## word/document.xml ############################## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Cell 1 + + + + + + 1 + + + + + + + + + + + + + + + Cell 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + Note 1 + + + + + + + + + + First footnote. + + + + + + + + + + Second footnote. + + + + + + + + diff --git a/test/references/manual_footnotes/footnotes_and_annotated_linebreaks_true.latex.txt b/test/references/manual_footnotes/footnotes_and_annotated_linebreaks_true.latex.txt new file mode 100644 index 0000000..95b488e --- /dev/null +++ b/test/references/manual_footnotes/footnotes_and_annotated_linebreaks_true.latex.txt @@ -0,0 +1,23 @@ +\documentclass{article} +\usepackage{threeparttable} +\usepackage{multirow} +\usepackage{booktabs} +\begin{document} +\begin{table}[!ht] +\setlength\tabcolsep{0pt} +\centering +\begin{threeparttable} +\begin{tabular}{@{\extracolsep{2ex}}*{2}{cc}} +\toprule +Cell 1\tnote{1} & Cell 2 \\ +\bottomrule +\end{tabular} +\begin{tablenotes}[flushleft] +\footnotesize +\item[1]Note 1 +\item[]First footnote. +\item[]Second footnote. +\end{tablenotes} +\end{threeparttable} +\end{table} +\end{document} \ No newline at end of file diff --git a/test/references/manual_footnotes/footnotes_and_annotated_linebreaks_true.txt b/test/references/manual_footnotes/footnotes_and_annotated_linebreaks_true.txt new file mode 100644 index 0000000..b8c11b0 --- /dev/null +++ b/test/references/manual_footnotes/footnotes_and_annotated_linebreaks_true.txt @@ -0,0 +1,38 @@ + + + + + + + + + +
Cell 11Cell 2
1 Note 1
First footnote.
Second footnote.
\ No newline at end of file diff --git a/test/references/manual_footnotes/footnotes_and_annotated_linebreaks_true.typ.txt b/test/references/manual_footnotes/footnotes_and_annotated_linebreaks_true.typ.txt new file mode 100644 index 0000000..7a741cf --- /dev/null +++ b/test/references/manual_footnotes/footnotes_and_annotated_linebreaks_true.typ.txt @@ -0,0 +1,17 @@ + +#table( + rows: 1, + columns: 2, + column-gutter: 0.25em, + align: (center, center), + stroke: none, + table.hline(y: 0, stroke: 1pt), + [Cell 1#super[1]], + [Cell 2], + table.hline(y: 1, stroke: 1pt), + table.cell(align: left, colspan: 2)[#text(size: 0.8em)[ + #super[1]Note 1\ + First footnote.\ + Second footnote. + ]], +) diff --git a/test/references/manual_footnotes/footnotes.docx.txt b/test/references/manual_footnotes/footnotes_linebreaks_false.docx.txt similarity index 100% rename from test/references/manual_footnotes/footnotes.docx.txt rename to test/references/manual_footnotes/footnotes_linebreaks_false.docx.txt diff --git a/test/references/manual_footnotes/footnotes.latex.txt b/test/references/manual_footnotes/footnotes_linebreaks_false.latex.txt similarity index 100% rename from test/references/manual_footnotes/footnotes.latex.txt rename to test/references/manual_footnotes/footnotes_linebreaks_false.latex.txt diff --git a/test/references/manual_footnotes/footnotes.txt b/test/references/manual_footnotes/footnotes_linebreaks_false.txt similarity index 100% rename from test/references/manual_footnotes/footnotes.txt rename to test/references/manual_footnotes/footnotes_linebreaks_false.txt diff --git a/test/references/manual_footnotes/footnotes.typ.txt b/test/references/manual_footnotes/footnotes_linebreaks_false.typ.txt similarity index 65% rename from test/references/manual_footnotes/footnotes.typ.txt rename to test/references/manual_footnotes/footnotes_linebreaks_false.typ.txt index bea14b4..f5aa1e5 100644 --- a/test/references/manual_footnotes/footnotes.typ.txt +++ b/test/references/manual_footnotes/footnotes_linebreaks_false.typ.txt @@ -9,5 +9,5 @@ [Cell 1], [Cell 2], table.hline(y: 1, stroke: 1pt), - table.cell(align: left, colspan: 2)[First footnote.#h(1.5em, weak: true)Second footnote.], + table.cell(align: left, colspan: 2)[#text(size: 0.8em)[First footnote.#h(1.5em, weak: true)Second footnote.]], ) diff --git a/test/references/manual_footnotes/footnotes_linebreaks_true.docx.txt b/test/references/manual_footnotes/footnotes_linebreaks_true.docx.txt new file mode 100644 index 0000000..9192e3b --- /dev/null +++ b/test/references/manual_footnotes/footnotes_linebreaks_true.docx.txt @@ -0,0 +1,279 @@ +############################## [Content_Types].xml ############################## + + + + + + + + + +############################## _rels/.rels ############################## + + + + +############################## word/_rels/document.xml.rels ############################## + + + + +############################## word/styles.xml ############################## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +############################## word/document.xml ############################## + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Cell 1 + + + + + + + + + + + + + + + Cell 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + First footnote. + + + + + + + + + + Second footnote. + + + + + + + + diff --git a/test/references/manual_footnotes/footnotes_linebreaks_true.latex.txt b/test/references/manual_footnotes/footnotes_linebreaks_true.latex.txt new file mode 100644 index 0000000..541eb80 --- /dev/null +++ b/test/references/manual_footnotes/footnotes_linebreaks_true.latex.txt @@ -0,0 +1,22 @@ +\documentclass{article} +\usepackage{threeparttable} +\usepackage{multirow} +\usepackage{booktabs} +\begin{document} +\begin{table}[!ht] +\setlength\tabcolsep{0pt} +\centering +\begin{threeparttable} +\begin{tabular}{@{\extracolsep{2ex}}*{2}{cc}} +\toprule +Cell 1 & Cell 2 \\ +\bottomrule +\end{tabular} +\begin{tablenotes}[flushleft] +\footnotesize +\item[]First footnote. +\item[]Second footnote. +\end{tablenotes} +\end{threeparttable} +\end{table} +\end{document} \ No newline at end of file diff --git a/test/references/manual_footnotes/footnotes_linebreaks_true.txt b/test/references/manual_footnotes/footnotes_linebreaks_true.txt new file mode 100644 index 0000000..d3bd79b --- /dev/null +++ b/test/references/manual_footnotes/footnotes_linebreaks_true.txt @@ -0,0 +1,38 @@ + + + + + + + + + +
Cell 1Cell 2
First footnote.
Second footnote.
\ No newline at end of file diff --git a/test/references/manual_footnotes/footnotes_linebreaks_true.typ.txt b/test/references/manual_footnotes/footnotes_linebreaks_true.typ.txt new file mode 100644 index 0000000..3df5201 --- /dev/null +++ b/test/references/manual_footnotes/footnotes_linebreaks_true.typ.txt @@ -0,0 +1,16 @@ + +#table( + rows: 1, + columns: 2, + column-gutter: 0.25em, + align: (center, center), + stroke: none, + table.hline(y: 0, stroke: 1pt), + [Cell 1], + [Cell 2], + table.hline(y: 1, stroke: 1pt), + table.cell(align: left, colspan: 2)[#text(size: 0.8em)[ + First footnote.\ + Second footnote. + ]], +) diff --git a/test/references/merged_cells/custom_datatypes.latex.txt b/test/references/merged_cells/custom_datatypes.latex.txt index 10676a8..60aa9cf 100644 --- a/test/references/merged_cells/custom_datatypes.latex.txt +++ b/test/references/merged_cells/custom_datatypes.latex.txt @@ -16,7 +16,7 @@ \multicolumn{2}{c}{Label\tnote{1}} \\ \bottomrule \end{tabular} -\begin{tablenotes}[flushleft,para] +\begin{tablenotes}[flushleft] \footnotesize \item[1]Annotation \end{tablenotes} diff --git a/test/references/merged_cells/custom_datatypes.typ.txt b/test/references/merged_cells/custom_datatypes.typ.txt index d2e7dc2..298d04e 100644 --- a/test/references/merged_cells/custom_datatypes.typ.txt +++ b/test/references/merged_cells/custom_datatypes.typ.txt @@ -12,5 +12,7 @@ table.cell(colspan: 2)[AB], table.cell(colspan: 2)[Label#super[1]], table.hline(y: 5, stroke: 1pt), - table.cell(align: left, colspan: 2)[#super[1]#text(size: 0.8em)[Annotation]], + table.cell(align: left, colspan: 2)[#text(size: 0.8em)[ + #super[1]Annotation + ]], ) diff --git a/test/references/replace/replacemissing_default.latex.txt b/test/references/replace/replacemissing_default.latex.txt index 5ae42c2..9efb22b 100644 --- a/test/references/replace/replacemissing_default.latex.txt +++ b/test/references/replace/replacemissing_default.latex.txt @@ -13,9 +13,9 @@ 1 & 2 \\ \bottomrule \end{tabular} -\begin{tablenotes}[flushleft,para] +\begin{tablenotes}[flushleft] \footnotesize -- No value +\item[]- No value \end{tablenotes} \end{threeparttable} \end{table} diff --git a/test/references/replace/replacemissing_default.typ.txt b/test/references/replace/replacemissing_default.typ.txt index e918d28..12fa84b 100644 --- a/test/references/replace/replacemissing_default.typ.txt +++ b/test/references/replace/replacemissing_default.typ.txt @@ -11,5 +11,7 @@ [1], [2], table.hline(y: 2, stroke: 1pt), - table.cell(align: left, colspan: 2)[#text(size: 0.8em)[- No value]], + table.cell(align: left, colspan: 2)[#text(size: 0.8em)[ + - No value + ]], ) diff --git a/test/references/table_one/all_missing_group.latex.txt b/test/references/table_one/all_missing_group.latex.txt index 6f20de5..d433b31 100644 --- a/test/references/table_one/all_missing_group.latex.txt +++ b/test/references/table_one/all_missing_group.latex.txt @@ -19,9 +19,9 @@ \hspace{12.0pt}Missing & 3 (50\%) & 3 (100\%) & 0 (0\%) \\ \bottomrule \end{tabular} -\begin{tablenotes}[flushleft,para] +\begin{tablenotes}[flushleft] \footnotesize -NC - Not computable +\item[]NC - Not computable \end{tablenotes} \end{threeparttable} \end{table} diff --git a/test/references/table_one/all_missing_group.typ.txt b/test/references/table_one/all_missing_group.typ.txt index 91cc64a..1599546 100644 --- a/test/references/table_one/all_missing_group.typ.txt +++ b/test/references/table_one/all_missing_group.typ.txt @@ -32,5 +32,7 @@ [3 (100%)], [0 (0%)], table.hline(y: 6, stroke: 1pt), - table.cell(colspan: 4)[#text(size: 0.8em)[NC - Not computable]], + table.cell(colspan: 4)[#text(size: 0.8em)[ + NC - Not computable + ]], ) diff --git a/test/runtests.jl b/test/runtests.jl index 8ea37a3..eb9f81f 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -475,27 +475,27 @@ end end @testset "manual footnotes" begin - t = Table( - [ - SpannedCell(1, 1, "Cell 1"), - SpannedCell(1, 2, "Cell 2"), - ], - nothing, - nothing, - footnotes = ["First footnote.", "Second footnote."] - ) - reftest(t, "references/manual_footnotes/footnotes") - - t = Table( - [ - SpannedCell(1, 1, Annotated("Cell 1", "Note 1")), - SpannedCell(1, 2, "Cell 2"), - ], - nothing, - nothing, - footnotes = ["First footnote.", "Second footnote."] - ) - reftest(t, "references/manual_footnotes/footnotes_and_annotated") + for linebreak_footnotes in [true, false] + t = Table( + [ + SpannedCell(1, 1, "Cell 1"), + SpannedCell(1, 2, "Cell 2"), + ]; + footnotes = ["First footnote.", "Second footnote."], + linebreak_footnotes, + ) + reftest(t, "references/manual_footnotes/footnotes_linebreaks_$linebreak_footnotes") + + t = Table( + [ + SpannedCell(1, 1, Annotated("Cell 1", "Note 1")), + SpannedCell(1, 2, "Cell 2"), + ]; + footnotes = ["First footnote.", "Second footnote."], + linebreak_footnotes, + ) + reftest(t, "references/manual_footnotes/footnotes_and_annotated_linebreaks_$linebreak_footnotes") + end end @testset "Replace" begin