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

tagform applied unevenly #54

Closed
juhaszp95 opened this issue Apr 29, 2023 · 4 comments
Closed

tagform applied unevenly #54

juhaszp95 opened this issue Apr 29, 2023 · 4 comments

Comments

@juhaszp95
Copy link

Hi There,

I'm trying to make my equation tags use the capital form of the numbers/letters/symbols, which is especially important in the appendix where e.g. Eq. (A.1) would look 'uneven' otherwise. However, when I declare the relevant tagform, it only seems to apply to a part of the tag.

MWE (to be run in LuaLaTeX):

\documentclass{article}
\usepackage{libertinus-otf}
\usepackage{mathtools}

\begin{document}
	\newtagform{caps}[\addfontfeatures{Letters=Uppercase}]{(}{)}
	\usetagform{caps}

	%\let\oldeq\theequation
	%\renewcommand\theequation{\addfontfeatures{Letters=Uppercase}\oldeq}

	\begin{equation}
		bla
	\end{equation}	
\end{document}

This gives me:
image

Notice the different brackets. Basically, I'd like both the brackets and the letters/numbers in the tag itself to use \addfontfeatures{Letters=Uppercase}. The commented lines in the code let me apply it to the number itself, but not the brackets. Any help would be appreciated.

@muzimuzhi
Copy link
Contributor

In current implementation, the optional argument of \newtagform{<name>}[<inner_format>]{<left>}{<right>}, inner_format, is inserted after <left> hence is expected to influence the equation number only, by taking it as argument.

mathtools/mathtools.dtx

Lines 3311 to 3313 in 58d1461

\def\MT_define_tagform:nwnn #1[#2]#3#4{
\@namedef{MT_tagform_#1:n}##1
{\maketag@@@{#3\ignorespaces#2{##1}\unskip\@@italiccorr#4}}

mathtools/mathtools.dtx

Lines 3322 to 3332 in 58d1461

\providecommand*\newtagform[1]{%
\@ifundefined{MT_tagform_#1:n}
{\@ifnextchar[%
{\MT_define_tagform:nwnn #1}%
{\MT_define_tagform:nwnn #1[]}%
}{\PackageError{mathtools}
{The~ tag~ form~ `#1'~ is~ already~ defined\MessageBreak
You~ probably~ want~ to~ look~ up~ \@backslashchar renewtagform~
instead}
{I~ will~ just~ ignore~ your~ wish~ for~ now.}}
}

As a workaround you can try prepending the format code to <left>, like \newtagform{brackets2}{\addfontfeatures{Letters=Uppercase}(}{)}

\documentclass{article}
\usepackage{libertinus-otf}
\usepackage{mathtools}

\begin{document}
	\newtagform{brackets2}[\addfontfeatures{Letters=Uppercase}]{(}{)}
	\usetagform{brackets2}

	\begin{equation}
		bla
	\end{equation}

	\renewtagform{brackets2}{\addfontfeatures{Letters=Uppercase}(}{)}

	\begin{equation}
		bla
	\end{equation}
\end{document}

image

@juhaszp95
Copy link
Author

juhaszp95 commented Apr 30, 2023

Perfect, this solves my problem, many thanks. I'll keep the issue open in case you want to change the implementation, but feel free to close it if you like.

@daleif
Copy link
Collaborator

daleif commented Jan 18, 2024

@muzimuzhi wouldn't it be enough here to just use

 \def\MT_define_tagform:nwnn #1[#2]#3#4{ 
   \@namedef{MT_tagform_#1:n}##1 
     {\maketag@@@{#3\ignorespaces{#2{##1}}\unskip\@@italiccorr#4}} 

(and extra set of braces), not sure if is breaks something.

We cannot add #2 inside {##1} as one might want to access it as an argument.

@daleif daleif closed this as completed in fa384da Jan 19, 2024
@daleif
Copy link
Collaborator

daleif commented Jan 19, 2024

Addd a brace pair such that anything in #2 only applies to {##1}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants