-
-
Notifications
You must be signed in to change notification settings - Fork 249
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
Adjustments to \verb and +v (ltcmd) #1087
Conversation
Includes a temporary fix to l3doc that will need to be moved back to expl3 in due course.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that it is good to provide @vobeytabs. It might complicate the situation in the field --- needs some thought
base/ltmiscen.dtx
Outdated
{\catcode`\^^I=\active | ||
\gdef\@vobeytabs{\catcode`\^^I\active\let^^I\@xobeytab}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we sure that it is better to have a separate command or to stick the TAB handling into @vobeyspaces? I'm just wondering, but there are several packages out there that mimic verbatim setup and maybe they would not have to change and nevertheless pick up the ^Î handling this way. Just as thought ... not thought through
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see this both ways. I agree that if you want to say 'basically tabs are spaces' then yes, it makes sense not to have a separate macro. But the moment you handle tabs there's the possibility of diverging from space handling, and it was that I was thinking of: in particular, people could allow a tab to convert to multiple spaces in verb material.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could still be moved (by default) into @vobeyspaces (using your @vobeytabs macro) this way probably avoid all the redefs and still gains the flexibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you mean include \@vobeytabs
in the def. for \@vobeyspaces
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't mean this originally, but yes, your argument about being able to adjust it is valid, so I now thought moving it in there gives you the best of both worlds
base/ltmiscen.dtx
Outdated
%<latexrelease>\IncludeInRelease{2023/11/01}% | ||
%<latexrelease> {\verbatim}{Obeyed tabs}% | ||
%<*2ekernel|latexrelease> | ||
\def\verbatim{\@verbatim \frenchspacing\@vobeyspaces\@vobeytabs \@xverbatim} | ||
%</2ekernel|latexrelease> | ||
%<latexrelease>\EndIncludeInRelease | ||
%<latexrelease>\IncludeInRelease{0000/00/00}% | ||
%<latexrelease> {\verbatim}{Obeyed tabs}% | ||
%<latexrelease>\def\verbatim{\@verbatim \frenchspacing\@vobeyspaces \@xverbatim} | ||
%<latexrelease>\EndIncludeInRelease | ||
%<*2ekernel> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if tabs are handled inside @vobeyspaces then this hsouldn't be needed, should it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd wondered about that. However, that leaves you vulnerable - to a re-definition of \@vobeyspaces
, as that would also kill tab support. That might of course be the position we want to take. So I've backed out my change and will look again at this - there's also something not quite right and I want to understand that too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the way I see it is this: we interpret \@vobeyspaces
as "handle all space like chars (space TAB, maybe others one day) for verbatim" and \@vobeytabs
as an indirection to do something special to tabs alone on top of it. To my knowledge there is no redefinition of \vobeyspaces
right now and if there is one in the future it has to take care of the assumption.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"all space-like chars"!
This could be a large number, and it can be somewhat controversial which ones are "truly space-like".
It is not even clear that TAB is always and everywhere considered space-like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See if you like the new version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure how to find the latest version.
base/ltmiscen.dtx
Outdated
% {Provide visible space in \cs{verb*} also for XeTeX and LuaTeX (github/69)} | ||
% \changes{v1.2b}{2023/06/14} | ||
% {Support visible tabs in \cs{verb*}} | ||
% \begin{macrocode} | ||
\@namedef{verbatim*}{\@verbatim | ||
\@setupverbvisiblespace | ||
\frenchspacing\@vobeyspaces\@sxverbatim} | ||
\@setupverbvisibletab | ||
\frenchspacing\@vobeyspaces\@vobeytabs\@sxverbatim} | ||
\expandafter\let\csname endverbatim*\endcsname =\endverbatim |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
base/ltmiscen.dtx
Outdated
%<latexrelease>\IncludeInRelease{2018/12/01}% | ||
%<latexrelease> {\verbatim*}{Setup visible space for \verb}% | ||
%<latexrelease>\@namedef{verbatim*}{\@verbatim | ||
%<latexrelease> \@setupverbvisiblespace | ||
%<latexrelease> \frenchspacing\@vobeyspaces\@sxverbatim} | ||
%<latexrelease>\EndIncludeInRelease |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
base/ltmiscen.dtx
Outdated
\ifnum\catcode`\ =\active | ||
\else \@setupverbvisiblespace \@vobeyspaces \fi | ||
\ifnum\catcode`\^^I=\active | ||
\else \@setupverbvisibletab \@vobeytabs \fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
however in that case I'm not sure this logic is still correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed: take a look at the modified one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this?
There seem to be a few comments etc that are still pending. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A typo and some replies/comments.
base/doc/usrguide.tex
Outdated
@@ -794,6 +794,42 @@ \subsection{Commands at the start of tabular cells} | |||
\end{tabular} | |||
\end{verbatim} | |||
|
|||
\subsection{Using the verbatim argument types} | |||
|
|||
As described about, the \texttt{v}-type argument may be viewed as similar to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this already got changed? Presumably: about ==> above ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure: the diff suggests that it now reads: aboveß ??
base/ltmiscen.dtx
Outdated
%<latexrelease>\IncludeInRelease{2023/11/01}% | ||
%<latexrelease> {\verbatim}{Obeyed tabs}% | ||
%<*2ekernel|latexrelease> | ||
\def\verbatim{\@verbatim \frenchspacing\@vobeyspaces\@vobeytabs \@xverbatim} | ||
%</2ekernel|latexrelease> | ||
%<latexrelease>\EndIncludeInRelease | ||
%<latexrelease>\IncludeInRelease{0000/00/00}% | ||
%<latexrelease> {\verbatim}{Obeyed tabs}% | ||
%<latexrelease>\def\verbatim{\@verbatim \frenchspacing\@vobeyspaces \@xverbatim} | ||
%<latexrelease>\EndIncludeInRelease | ||
%<*2ekernel> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"all space-like chars"!
This could be a large number, and it can be somewhat controversial which ones are "truly space-like".
It is not even clear that TAB is always and everywhere considered space-like.
base/ltmiscen.dtx
Outdated
%<latexrelease>\IncludeInRelease{2023/11/01}% | ||
%<latexrelease> {\verbatim}{Obeyed tabs}% | ||
%<*2ekernel|latexrelease> | ||
\def\verbatim{\@verbatim \frenchspacing\@vobeyspaces\@vobeytabs \@xverbatim} | ||
%</2ekernel|latexrelease> | ||
%<latexrelease>\EndIncludeInRelease | ||
%<latexrelease>\IncludeInRelease{0000/00/00}% | ||
%<latexrelease> {\verbatim}{Obeyed tabs}% | ||
%<latexrelease>\def\verbatim{\@verbatim \frenchspacing\@vobeyspaces \@xverbatim} | ||
%<latexrelease>\EndIncludeInRelease | ||
%<*2ekernel> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure how to find the latest version.
base/ltmiscen.dtx
Outdated
\ifnum\catcode`\ =\active | ||
\else \@setupverbvisiblespace \@vobeyspaces \fi | ||
\ifnum\catcode`\^^I=\active | ||
\else \@setupverbvisibletab \@vobeytabs \fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this?
When the code is finalised I shall review the text in usrguide: |
Removed: Frank suggested activating tabs was done as part of activating spaces, so it's all in one place. |
What was "Removed:"? I assume that it was not all the text in usrguide about verbatim and friends! |
I meant the lines you'd been talking about: Frank had various suggestions which I addressed. |
Aha! But I am now, at least, referring to the whole of the entry in usrguide. |
That's all still there :) |
base/doc/usrguide.tex
Outdated
@@ -796,7 +796,7 @@ \subsection{Commands at the start of tabular cells} | |||
|
|||
\subsection{Using the verbatim argument types} | |||
|
|||
As described about, the \texttt{v}-type argument may be viewed as similar to | |||
As described aboveß, the \texttt{v}-type argument may be viewed as similar to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a typo as well ;)
Is all this code now finalised? So that I can attempt to sort out the documentation. |
Yes no changes planned: awaiting thoughts from review |
@josephwright @FrankMittelbach Ok now it is clearer, thanks a lot. I’m curious though, how would you make the difference between |
(Aside: TeX strings are not like strings in other languages: you mean a token list.) Using \tl_set:Nn \l_tmpa_tl {#1} % The grabbed tokens
\tl_replace_all:Nnn \l_tmpa_tl { \par } { [PAR] } we would replace the \tl_set:Nn \l_tmpa_tl {#1} % The grabbed tokens
\tl_replace_all:Nxn \l_tmpa_tl { \token_to_str:N \par } { [PAR] } then the |
Oh, so |
One further typo, in ltnews38: I shall deal with the (slightly improved, hooray!) documentation later. |
One could further generalise and leave one end-of-line control sequence and one begin-of-line control sequence. Would make processing line wise easier and not hurt if the default would expand to empty. If one has to insert control sequences one could as well make processing really easier and not just hard in another way (and it wouldn't hurt typesetting with an empty control sequence -- though I doubt that direct typesetting is really the most used functionality for |
quite an interesting thought, worth exploring. |
+1 (re +v)from me on both: @FrankMittelbach certainly any such is worth investigating. @Skillmon on the usage of +v Please can you provide some examples of real-world usages of +v, with associated necessary/possible settings for the two commands. These examples will be useful both for the consideration stage and as a basis for some badly needed documentation of such uses. TIA ! |
Packages/classes I can find using
Most of the use cases here seem to be typesetting the content rather than writing to files, etc. |
I use Other than that |
Nice example (the |
It may be time to separate the changes to The former, where all is resolved, can thus be executed very soon now. The latter clearly need further ideas and discussion, followed by extensions of the documentation. |
@car222222 I've pulled out the parts of the PR that only impacted on |
Marking beginning and end of each line is easy enough when grabbing, but does it really offer a significant step up over simply marking boundaries? I'm not sure I see a use case where there is a non-trivial impact. |
If you want to process the contents line wise you can simply do |
@Skillmon Understood, thanks! |
This PR has been automatically marked as stale because it has not had recent activity. |
Internal housekeeping
Status of pull request
Checklist of required changes before merge will be approved
\changes
entries in source includedchanges.txt
updatedltnewsX.tex
(and/orlatexchanges.tex
) updated