diff --git a/news/changelog-1.9.md b/news/changelog-1.9.md index a1085ae47d1..3ea6db19514 100644 --- a/news/changelog-1.9.md +++ b/news/changelog-1.9.md @@ -40,6 +40,7 @@ All changes included in 1.9: - ([#10291](https://github.com/quarto-dev/quarto-cli/issues/10291)): Fix detection of babel hyphenation warnings with straight-quote format instead of backtick-quote format. - ([rstudio/tinytex-releases#49](https://github.com/rstudio/tinytex-releases/issues/49)): Fix detection of LuaTeX-ja missing file errors by matching both "File" and "file" in error messages. +- ([#9091](https://github.com/quarto-dev/quarto-cli/issues/9091)): Fix vertical alignment div has no effect for pdf output ## Projects diff --git a/src/resources/filters/layout/latex.lua b/src/resources/filters/layout/latex.lua index e5bce66ba45..e693fa64521 100644 --- a/src/resources/filters/layout/latex.lua +++ b/src/resources/filters/layout/latex.lua @@ -67,8 +67,14 @@ function latexPanel(layout) end local caption = create_latex_caption(layout) - -- read vertical alignment and strip attribute - local vAlign = validatedVAlign(layout.attributes[kLayoutVAlign]) + -- convert valign_class to latex notion, read vertical alignment and strip attribute + local vAlign = "top" + if layout.valign_class ~= nil then + local vAlignClass = layout.valign_class + vAlign = vAlignClass:gsub("quarto%-layout%-valign%-","") + end + + vAlign = validatedVAlign(vAlign) layout.attributes[kLayoutVAlign] = nil for i, row in ipairs(layout.rows.content) do diff --git a/tests/README.md b/tests/README.md index 5a6c200169f..3dbfd0dc65d 100644 --- a/tests/README.md +++ b/tests/README.md @@ -6,7 +6,7 @@ We run several type of tests - Unit tests, located in `unit/` folder - Integration tests, located in `integration/` folder -- smoke tests localed in `smoke` folder +- smoke tests located in `smoke` folder Tests are run in our CI workflow on GHA at each commit, and for each PR. diff --git a/tests/docs/smoke-all/2024/01/19/8354.tex.snapshot b/tests/docs/smoke-all/2024/01/19/8354.tex.snapshot index 305c0eb2744..81614883005 100644 --- a/tests/docs/smoke-all/2024/01/19/8354.tex.snapshot +++ b/tests/docs/smoke-all/2024/01/19/8354.tex.snapshot @@ -220,7 +220,7 @@ \caption{\label{tbl-tables}Tables} -\begin{minipage}{0.50\linewidth} +\begin{minipage}[t]{0.50\linewidth} \subcaption{\label{tbl-tables-1}cars} @@ -243,7 +243,7 @@ speed & dist\\ \end{minipage}% % -\begin{minipage}{0.50\linewidth} +\begin{minipage}[t]{0.50\linewidth} \subcaption{\label{tbl-tables-2}pressure} diff --git a/tests/docs/smoke-all/2025/11/08/9109.qmd b/tests/docs/smoke-all/2025/11/08/9109.qmd new file mode 100644 index 00000000000..0c3dbdc63db --- /dev/null +++ b/tests/docs/smoke-all/2025/11/08/9109.qmd @@ -0,0 +1,26 @@ +--- +title: "Untitled" +format: latex +execute: + warning: false +_quarto: + tests: + latex: + ensureSnapshotMatches: true +--- + +```{r} +#| label: tbl-tables +#| tbl-cap: "Tables" +#| tbl-subcap: +#| - cars +#| - pressure +#| layout-ncol: 2 +#| layout-valign: bottom + +library(knitr) +kable(head(cars)) +kable(head(pressure)) +``` + +See @tbl-tables for examples. In particular, @tbl-tables-2. diff --git a/tests/docs/smoke-all/2025/11/08/9109.tex.snapshot b/tests/docs/smoke-all/2025/11/08/9109.tex.snapshot new file mode 100644 index 00000000000..5e8ffedf59e --- /dev/null +++ b/tests/docs/smoke-all/2025/11/08/9109.tex.snapshot @@ -0,0 +1,277 @@ +% Options for packages loaded elsewhere +% Options for packages loaded elsewhere +\PassOptionsToPackage{unicode}{hyperref} +\PassOptionsToPackage{hyphens}{url} +\PassOptionsToPackage{dvipsnames,svgnames,x11names}{xcolor} +% +\documentclass[ + letterpaper, + DIV=11, + numbers=noendperiod]{scrartcl} +\usepackage{xcolor} +\usepackage{amsmath,amssymb} +\setcounter{secnumdepth}{-\maxdimen} % remove section numbering +\usepackage{iftex} +\ifPDFTeX + \usepackage[T1]{fontenc} + \usepackage[utf8]{inputenc} + \usepackage{textcomp} % provide euro and other symbols +\else % if luatex or xetex + \usepackage{unicode-math} % this also loads fontspec + \defaultfontfeatures{Scale=MatchLowercase} + \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} +\fi +\usepackage{lmodern} +\ifPDFTeX\else + % xetex/luatex font selection +\fi +% Use upquote if available, for straight quotes in verbatim environments +\IfFileExists{upquote.sty}{\usepackage{upquote}}{} +\IfFileExists{microtype.sty}{% use microtype if available + \usepackage[]{microtype} + \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts +}{} +\makeatletter +\@ifundefined{KOMAClassName}{% if non-KOMA class + \IfFileExists{parskip.sty}{% + \usepackage{parskip} + }{% else + \setlength{\parindent}{0pt} + \setlength{\parskip}{6pt plus 2pt minus 1pt}} +}{% if KOMA class + \KOMAoptions{parskip=half}} +\makeatother +% Make \paragraph and \subparagraph free-standing +\makeatletter +\ifx\paragraph\undefined\else + \let\oldparagraph\paragraph + \renewcommand{\paragraph}{ + \@ifstar + \xxxParagraphStar + \xxxParagraphNoStar + } + \newcommand{\xxxParagraphStar}[1]{\oldparagraph*{#1}\mbox{}} + \newcommand{\xxxParagraphNoStar}[1]{\oldparagraph{#1}\mbox{}} +\fi +\ifx\subparagraph\undefined\else + \let\oldsubparagraph\subparagraph + \renewcommand{\subparagraph}{ + \@ifstar + \xxxSubParagraphStar + \xxxSubParagraphNoStar + } + \newcommand{\xxxSubParagraphStar}[1]{\oldsubparagraph*{#1}\mbox{}} + \newcommand{\xxxSubParagraphNoStar}[1]{\oldsubparagraph{#1}\mbox{}} +\fi +\makeatother + +\usepackage{color} +\usepackage{fancyvrb} +\newcommand{\VerbBar}{|} +\newcommand{\VERB}{\Verb[commandchars=\\\{\}]} +\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}} +% Add ',fontsize=\small' for more characters per line +\usepackage{framed} +\definecolor{shadecolor}{RGB}{241,243,245} +\newenvironment{Shaded}{\begin{snugshade}}{\end{snugshade}} +\newcommand{\AlertTok}[1]{\textcolor[rgb]{0.68,0.00,0.00}{#1}} +\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.37,0.37,0.37}{#1}} +\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.40,0.45,0.13}{#1}} +\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.68,0.00,0.00}{#1}} +\newcommand{\BuiltInTok}[1]{\textcolor[rgb]{0.00,0.23,0.31}{#1}} +\newcommand{\CharTok}[1]{\textcolor[rgb]{0.13,0.47,0.30}{#1}} +\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.37,0.37,0.37}{#1}} +\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.37,0.37,0.37}{\textit{#1}}} +\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{#1}} +\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.23,0.31}{\textbf{#1}}} +\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.68,0.00,0.00}{#1}} +\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.68,0.00,0.00}{#1}} +\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.37,0.37,0.37}{\textit{#1}}} +\newcommand{\ErrorTok}[1]{\textcolor[rgb]{0.68,0.00,0.00}{#1}} +\newcommand{\ExtensionTok}[1]{\textcolor[rgb]{0.00,0.23,0.31}{#1}} +\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.68,0.00,0.00}{#1}} +\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.28,0.35,0.67}{#1}} +\newcommand{\ImportTok}[1]{\textcolor[rgb]{0.00,0.46,0.62}{#1}} +\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.37,0.37,0.37}{#1}} +\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.23,0.31}{\textbf{#1}}} +\newcommand{\NormalTok}[1]{\textcolor[rgb]{0.00,0.23,0.31}{#1}} +\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.37,0.37,0.37}{#1}} +\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.23,0.31}{#1}} +\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.68,0.00,0.00}{#1}} +\newcommand{\RegionMarkerTok}[1]{\textcolor[rgb]{0.00,0.23,0.31}{#1}} +\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.37,0.37,0.37}{#1}} +\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.13,0.47,0.30}{#1}} +\newcommand{\StringTok}[1]{\textcolor[rgb]{0.13,0.47,0.30}{#1}} +\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.07,0.07,0.07}{#1}} +\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.13,0.47,0.30}{#1}} +\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.37,0.37,0.37}{\textit{#1}}} + +\usepackage{longtable,booktabs,array} +\usepackage{calc} % for calculating minipage widths +% Correct order of tables after \paragraph or \subparagraph +\usepackage{etoolbox} +\makeatletter +\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{} +\makeatother +% Allow footnotes in longtable head/foot +\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}} +\makesavenoteenv{longtable} +\usepackage{graphicx} +\makeatletter +\newsavebox\pandoc@box +\newcommand*\pandocbounded[1]{% scales image to fit in text height/width + \sbox\pandoc@box{#1}% + \Gscale@div\@tempa{\textheight}{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax}% + \Gscale@div\@tempb{\linewidth}{\wd\pandoc@box}% + \ifdim\@tempb\p@<\@tempa\p@\let\@tempa\@tempb\fi% select the smaller of both + \ifdim\@tempa\p@<\p@\scalebox{\@tempa}{\usebox\pandoc@box}% + \else\usebox{\pandoc@box}% + \fi% +} +% Set default figure placement to htbp +\def\fps@figure{htbp} +\makeatother + + + + + +\setlength{\emergencystretch}{3em} % prevent overfull lines + +\providecommand{\tightlist}{% + \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} + + + + + + +\KOMAoption{captions}{tableheading} +\makeatletter +\@ifpackageloaded{caption}{}{\usepackage{caption}} +\AtBeginDocument{% +\ifdefined\contentsname + \renewcommand*\contentsname{Table of contents} +\else + \newcommand\contentsname{Table of contents} +\fi +\ifdefined\listfigurename + \renewcommand*\listfigurename{List of Figures} +\else + \newcommand\listfigurename{List of Figures} +\fi +\ifdefined\listtablename + \renewcommand*\listtablename{List of Tables} +\else + \newcommand\listtablename{List of Tables} +\fi +\ifdefined\figurename + \renewcommand*\figurename{Figure} +\else + \newcommand\figurename{Figure} +\fi +\ifdefined\tablename + \renewcommand*\tablename{Table} +\else + \newcommand\tablename{Table} +\fi +} +\@ifpackageloaded{float}{}{\usepackage{float}} +\floatstyle{ruled} +\@ifundefined{c@chapter}{\newfloat{codelisting}{h}{lop}}{\newfloat{codelisting}{h}{lop}[chapter]} +\floatname{codelisting}{Listing} +\newcommand*\listoflistings{\listof{codelisting}{List of Listings}} +\makeatother +\makeatletter +\makeatother +\makeatletter +\@ifpackageloaded{caption}{}{\usepackage{caption}} +\@ifpackageloaded{subcaption}{}{\usepackage{subcaption}} +\makeatother +\usepackage{bookmark} +\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available +\urlstyle{same} +\hypersetup{ + pdftitle={Untitled}, + colorlinks=true, + linkcolor={blue}, + filecolor={Maroon}, + citecolor={Blue}, + urlcolor={Blue}, + pdfcreator={LaTeX via pandoc}} + + +\title{Untitled} +\author{} +\date{} +\begin{document} +\maketitle + + +\begin{Shaded} +\begin{Highlighting}[] +\FunctionTok{library}\NormalTok{(knitr)} +\FunctionTok{kable}\NormalTok{(}\FunctionTok{head}\NormalTok{(cars))} +\FunctionTok{kable}\NormalTok{(}\FunctionTok{head}\NormalTok{(pressure))} +\end{Highlighting} +\end{Shaded} + +\begin{table} + +\caption{\label{tbl-tables}Tables} + +\begin{minipage}[b]{0.50\linewidth} + +\subcaption{\label{tbl-tables-1}cars} + +\centering{ + +\begin{tabular}{rr} +\toprule +speed & dist\\ +\midrule +4 & 2\\ +4 & 10\\ +7 & 4\\ +7 & 22\\ +8 & 16\\ +9 & 10\\ +\bottomrule +\end{tabular} + +} + +\end{minipage}% +% +\begin{minipage}[b]{0.50\linewidth} + +\subcaption{\label{tbl-tables-2}pressure} + +\centering{ + +\begin{tabular}{rr} +\toprule +temperature & pressure\\ +\midrule +0 & 0.0002\\ +20 & 0.0012\\ +40 & 0.0060\\ +60 & 0.0300\\ +80 & 0.0900\\ +100 & 0.2700\\ +\bottomrule +\end{tabular} + +} + +\end{minipage}% + +\end{table}% + +See Table~\ref{tbl-tables} for examples. In particular, +Table~\ref{tbl-tables-2}. + + + + +\end{document}