Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tagging (phase-III) lets center environment into minipage #119

Closed
John02139 opened this issue Jul 11, 2024 · 4 comments
Closed

Tagging (phase-III) lets center environment into minipage #119

John02139 opened this issue Jul 11, 2024 · 4 comments
Labels
bug Something isn't working in code we maintain (directly)

Comments

@John02139
Copy link
Contributor

John02139 commented Jul 11, 2024

I encountered the following with a verbatim environment inside a centered minipage. Without tagging, the minipage is centered, but the verbatim content inside the minipage is not centered (as desired). With tagging, the verbatim material is centered.

\DocumentMetadata 
{
	pdfstandard = a-4f,
	pdfversion  = 2.0,
	lang		= en-US,
	testphase = {phase-III}, % <==== with testphase, the verbatim code becomes centered.
}
\documentclass[11pt]{article}

\newcommand*{\Sphinx}{I won't say. }

\begin{document}

\begin{center}
\begin{minipage}{0.8\textwidth}
\begin{verbatim}

\Sphinx\Sphinx\Sphinx\Sphinx\Sphinx\Sphinx\Sphinx
\Sphinx\Sphinx\Sphinx\Sphinx\Sphinx
\Sphinx\Sphinx\Sphinx

\end{verbatim}
\end{minipage}
\end{center}

\end{document}  
@FrankMittelbach FrankMittelbach added the bug Something isn't working in code we maintain (directly) label Jul 11, 2024
@u-fischer
Copy link
Member

Well it is not the minipage. You get similar problems without it. The problem is that the display environments do not reset the para-instance. That means they inherit from the center environment. You can change that with the optional argument

\begin{verbatim}[para-instance=justify]

Generally, in standard LaTeX a list resets parts of the values, e.g. the leftskip is always 0pt. But it doesn't look very consistent, e.g. a \raggedleft outside gives a \raggedright inside the list, so I'm not sure if that is by design ...

\documentclass[11pt]{article}

\usepackage{lipsum}
\begin{document}

\lipsum[1][1-4]
\begin{center}
\begin{itemize}
\item \lipsum[1][1-4]
\end{itemize}
\end{center}

\raggedright
\lipsum[1][1-4]
\begin{center}
\begin{itemize}
\item \lipsum[1][1-4]
\end{itemize}
\end{center}

\raggedleft
\lipsum[1][1-4]
\begin{center}
\begin{itemize}
\item \lipsum[1][1-4]
\end{itemize}
\end{center}

\end{document}

image

With the block code one could reset the para-instance:

\DocumentMetadata 
{
	pdfstandard = a-4f,
	pdfversion  = 2.0,
	lang		= en-US,
	testphase = {block}, % 
}
\documentclass[11pt]{article}

\usepackage{lipsum}
\begin{document}
\RenewDocumentEnvironment{itemize}{!O{}}
    { \UseInstance{blockenv}{itemize} {para-instance=justify,#1} } %<-----------
    { \endblockenv }

\lipsum[1][1-4]
\begin{center}
\begin{itemize}
\item \lipsum[1][1-4]
\end{itemize}
\end{center}

\raggedright
\lipsum[1][1-4]
\begin{center}
\begin{itemize}
\item \lipsum[1][1-4]
\end{itemize}
\end{center}

\raggedleft
\lipsum[1][1-4]
\begin{center}
\begin{itemize}
\item \lipsum[1][1-4]
\end{itemize}
\end{center}

\end{document}

This gives always justified paragraphs inside the list. But I couldn't setup a para-instance that reproduce the standard latex setup and I'm not sure what we really want here.

@FrankMittelbach
Copy link
Member

I think the expectation is that verbatim is verbatim, thus in an LR document it should always be left aligned. One can argue about whether or not other lists should inherit values or not, but for verbatim I think it is simply a bug.

\EditInstance{blockenv}{verbatim}{ para-instance=justify } 

fixes that, but I think it should be set this way in latex-lab-block already.

@u-fischer
Copy link
Member

For verbatim this is fixed in develop. For other lists this is now referenced in #546

@u-fischer u-fischer added the fixed in release issue is fixed and will be deployed in the next release of package or kernel label Aug 11, 2024
@John02139
Copy link
Contributor Author

Confirming fixed in dev and closing.

@FrankMittelbach FrankMittelbach removed the fixed in release issue is fixed and will be deployed in the next release of package or kernel label Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working in code we maintain (directly)
Projects
None yet
Development

No branches or pull requests

3 participants