How to fix this capitalization issue of a macro in the title-command?
I wrote the following code to typeset the title page of a paper:
documentclass{amsart}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage[USenglish]{babel}
begin{document}
title[Title Title Title]{Title Title Title}
begin{abstract}
Abstract abstract abstract
end{abstract}
maketitle
end{document}
This outputs the following:
However, I wanted to make my title a macro, because I need it elsewhere too:
documentclass{amsart}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage[USenglish]{babel}
newcommandmytitle{Title title title}
begin{document}
title[mytitle]{mytitle}
begin{abstract}
Abstract abstract abstract
end{abstract}
maketitle
end{document}
But this now outputs the following:
No way of fiddling got me the capitalization back. E.g. there is no difference in using def
. What is happening here and how to fix it?
macros formatting titles capitalization
add a comment |
I wrote the following code to typeset the title page of a paper:
documentclass{amsart}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage[USenglish]{babel}
begin{document}
title[Title Title Title]{Title Title Title}
begin{abstract}
Abstract abstract abstract
end{abstract}
maketitle
end{document}
This outputs the following:
However, I wanted to make my title a macro, because I need it elsewhere too:
documentclass{amsart}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage[USenglish]{babel}
newcommandmytitle{Title title title}
begin{document}
title[mytitle]{mytitle}
begin{abstract}
Abstract abstract abstract
end{abstract}
maketitle
end{document}
But this now outputs the following:
No way of fiddling got me the capitalization back. E.g. there is no difference in using def
. What is happening here and how to fix it?
macros formatting titles capitalization
expandaftertitleexpandafter{mytitle}
should work.
– Ulrike Fischer
1 hour ago
@UlrikeFischer I tried this, and unformtunately it does not work.
– M. Winter
54 mins ago
add a comment |
I wrote the following code to typeset the title page of a paper:
documentclass{amsart}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage[USenglish]{babel}
begin{document}
title[Title Title Title]{Title Title Title}
begin{abstract}
Abstract abstract abstract
end{abstract}
maketitle
end{document}
This outputs the following:
However, I wanted to make my title a macro, because I need it elsewhere too:
documentclass{amsart}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage[USenglish]{babel}
newcommandmytitle{Title title title}
begin{document}
title[mytitle]{mytitle}
begin{abstract}
Abstract abstract abstract
end{abstract}
maketitle
end{document}
But this now outputs the following:
No way of fiddling got me the capitalization back. E.g. there is no difference in using def
. What is happening here and how to fix it?
macros formatting titles capitalization
I wrote the following code to typeset the title page of a paper:
documentclass{amsart}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage[USenglish]{babel}
begin{document}
title[Title Title Title]{Title Title Title}
begin{abstract}
Abstract abstract abstract
end{abstract}
maketitle
end{document}
This outputs the following:
However, I wanted to make my title a macro, because I need it elsewhere too:
documentclass{amsart}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage[USenglish]{babel}
newcommandmytitle{Title title title}
begin{document}
title[mytitle]{mytitle}
begin{abstract}
Abstract abstract abstract
end{abstract}
maketitle
end{document}
But this now outputs the following:
No way of fiddling got me the capitalization back. E.g. there is no difference in using def
. What is happening here and how to fix it?
macros formatting titles capitalization
macros formatting titles capitalization
asked 1 hour ago
M. Winter
28519
28519
expandaftertitleexpandafter{mytitle}
should work.
– Ulrike Fischer
1 hour ago
@UlrikeFischer I tried this, and unformtunately it does not work.
– M. Winter
54 mins ago
add a comment |
expandaftertitleexpandafter{mytitle}
should work.
– Ulrike Fischer
1 hour ago
@UlrikeFischer I tried this, and unformtunately it does not work.
– M. Winter
54 mins ago
expandaftertitleexpandafter{mytitle}
should work.– Ulrike Fischer
1 hour ago
expandaftertitleexpandafter{mytitle}
should work.– Ulrike Fischer
1 hour ago
@UlrikeFischer I tried this, and unformtunately it does not work.
– M. Winter
54 mins ago
@UlrikeFischer I tried this, and unformtunately it does not work.
– M. Winter
54 mins ago
add a comment |
2 Answers
2
active
oldest
votes
Unfortunately, amsart
uses by default uppercase
(a big nuisance). Happily, the fix is simple: load textcase
.
documentclass{amsart}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage[USenglish]{babel}
usepackage{textcase}
newcommandmytitle{Title title title}
begin{document}
title[mytitle]{mytitle}
begin{abstract}
Abstract abstract abstract
end{abstract}
maketitle
end{document}
Let's see the definition of title
renewcommand*{title}[2]{gdefshorttitle{#1}gdef@title{#2}}
edeftitle{@nx@dblarg
@xp@nxcsnamestringtitleendcsname}
This is a common trick in the class for telling LaTeX that if the optional argument is missing then the mandatory argument should be supplied instead.
The problem arises when maketitle
is processed, which does @settitle
:
def@settitle{begin{center}%
baselineskip14p@relax
bfseries
uppercasenonmath@title
@title
end{center}%
}
OK, we should look at uppercasenonmath
:
newcommand{uppercasenonmath}[1]{toks@@emptytoks
@xp@skipmath@xp@empty#1$$%
edef#1{{@nxprotect@nx@upprepthetoks@}}%
}
This only expands @title
once, so at the end the primitive uppercase
is applied to mytitle
(it would be a bit long to go into the details). However the class also has
AtBeginDocument{%
@ifundefined{MakeTextUppercase}{}{letuppercasenonmathaltucnm}%
}
and we find
defaltucnm#1{%
MakeTextUppercase{toks@{#1}}%
edef#1{thetoks@}%
}
and this is much better, because MakeTextUppercase
does full (protected) expansion of its argument, so your mytitle
gets expanded before uppercasing is done.
Thank you, this solved the problem. Can you tell a little bit about why this problem happened in the first place and how textcase fixed it?
– M. Winter
53 mins ago
@M.Winter Added some details
– egreg
37 mins ago
add a comment |
Too long for a comment
expandafterexpandafterexpandaftertitleexpandafterexpandafterexpandafter[expandaftermytitleexpandafter]expandafter{mytitle}
But @egreg answer is worthwile reading too. :)
Wow, this is insanity. I mean I triedexpandafter
, but I was not aware that just using more might fix the problem :D
– M. Winter
21 mins ago
eh eh... you usually need them by groups of2^n -1
heren=2
because we need to expand once two things.
– jfbu
19 mins ago
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f468245%2fhow-to-fix-this-capitalization-issue-of-a-macro-in-the-title-command%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Unfortunately, amsart
uses by default uppercase
(a big nuisance). Happily, the fix is simple: load textcase
.
documentclass{amsart}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage[USenglish]{babel}
usepackage{textcase}
newcommandmytitle{Title title title}
begin{document}
title[mytitle]{mytitle}
begin{abstract}
Abstract abstract abstract
end{abstract}
maketitle
end{document}
Let's see the definition of title
renewcommand*{title}[2]{gdefshorttitle{#1}gdef@title{#2}}
edeftitle{@nx@dblarg
@xp@nxcsnamestringtitleendcsname}
This is a common trick in the class for telling LaTeX that if the optional argument is missing then the mandatory argument should be supplied instead.
The problem arises when maketitle
is processed, which does @settitle
:
def@settitle{begin{center}%
baselineskip14p@relax
bfseries
uppercasenonmath@title
@title
end{center}%
}
OK, we should look at uppercasenonmath
:
newcommand{uppercasenonmath}[1]{toks@@emptytoks
@xp@skipmath@xp@empty#1$$%
edef#1{{@nxprotect@nx@upprepthetoks@}}%
}
This only expands @title
once, so at the end the primitive uppercase
is applied to mytitle
(it would be a bit long to go into the details). However the class also has
AtBeginDocument{%
@ifundefined{MakeTextUppercase}{}{letuppercasenonmathaltucnm}%
}
and we find
defaltucnm#1{%
MakeTextUppercase{toks@{#1}}%
edef#1{thetoks@}%
}
and this is much better, because MakeTextUppercase
does full (protected) expansion of its argument, so your mytitle
gets expanded before uppercasing is done.
Thank you, this solved the problem. Can you tell a little bit about why this problem happened in the first place and how textcase fixed it?
– M. Winter
53 mins ago
@M.Winter Added some details
– egreg
37 mins ago
add a comment |
Unfortunately, amsart
uses by default uppercase
(a big nuisance). Happily, the fix is simple: load textcase
.
documentclass{amsart}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage[USenglish]{babel}
usepackage{textcase}
newcommandmytitle{Title title title}
begin{document}
title[mytitle]{mytitle}
begin{abstract}
Abstract abstract abstract
end{abstract}
maketitle
end{document}
Let's see the definition of title
renewcommand*{title}[2]{gdefshorttitle{#1}gdef@title{#2}}
edeftitle{@nx@dblarg
@xp@nxcsnamestringtitleendcsname}
This is a common trick in the class for telling LaTeX that if the optional argument is missing then the mandatory argument should be supplied instead.
The problem arises when maketitle
is processed, which does @settitle
:
def@settitle{begin{center}%
baselineskip14p@relax
bfseries
uppercasenonmath@title
@title
end{center}%
}
OK, we should look at uppercasenonmath
:
newcommand{uppercasenonmath}[1]{toks@@emptytoks
@xp@skipmath@xp@empty#1$$%
edef#1{{@nxprotect@nx@upprepthetoks@}}%
}
This only expands @title
once, so at the end the primitive uppercase
is applied to mytitle
(it would be a bit long to go into the details). However the class also has
AtBeginDocument{%
@ifundefined{MakeTextUppercase}{}{letuppercasenonmathaltucnm}%
}
and we find
defaltucnm#1{%
MakeTextUppercase{toks@{#1}}%
edef#1{thetoks@}%
}
and this is much better, because MakeTextUppercase
does full (protected) expansion of its argument, so your mytitle
gets expanded before uppercasing is done.
Thank you, this solved the problem. Can you tell a little bit about why this problem happened in the first place and how textcase fixed it?
– M. Winter
53 mins ago
@M.Winter Added some details
– egreg
37 mins ago
add a comment |
Unfortunately, amsart
uses by default uppercase
(a big nuisance). Happily, the fix is simple: load textcase
.
documentclass{amsart}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage[USenglish]{babel}
usepackage{textcase}
newcommandmytitle{Title title title}
begin{document}
title[mytitle]{mytitle}
begin{abstract}
Abstract abstract abstract
end{abstract}
maketitle
end{document}
Let's see the definition of title
renewcommand*{title}[2]{gdefshorttitle{#1}gdef@title{#2}}
edeftitle{@nx@dblarg
@xp@nxcsnamestringtitleendcsname}
This is a common trick in the class for telling LaTeX that if the optional argument is missing then the mandatory argument should be supplied instead.
The problem arises when maketitle
is processed, which does @settitle
:
def@settitle{begin{center}%
baselineskip14p@relax
bfseries
uppercasenonmath@title
@title
end{center}%
}
OK, we should look at uppercasenonmath
:
newcommand{uppercasenonmath}[1]{toks@@emptytoks
@xp@skipmath@xp@empty#1$$%
edef#1{{@nxprotect@nx@upprepthetoks@}}%
}
This only expands @title
once, so at the end the primitive uppercase
is applied to mytitle
(it would be a bit long to go into the details). However the class also has
AtBeginDocument{%
@ifundefined{MakeTextUppercase}{}{letuppercasenonmathaltucnm}%
}
and we find
defaltucnm#1{%
MakeTextUppercase{toks@{#1}}%
edef#1{thetoks@}%
}
and this is much better, because MakeTextUppercase
does full (protected) expansion of its argument, so your mytitle
gets expanded before uppercasing is done.
Unfortunately, amsart
uses by default uppercase
(a big nuisance). Happily, the fix is simple: load textcase
.
documentclass{amsart}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage[USenglish]{babel}
usepackage{textcase}
newcommandmytitle{Title title title}
begin{document}
title[mytitle]{mytitle}
begin{abstract}
Abstract abstract abstract
end{abstract}
maketitle
end{document}
Let's see the definition of title
renewcommand*{title}[2]{gdefshorttitle{#1}gdef@title{#2}}
edeftitle{@nx@dblarg
@xp@nxcsnamestringtitleendcsname}
This is a common trick in the class for telling LaTeX that if the optional argument is missing then the mandatory argument should be supplied instead.
The problem arises when maketitle
is processed, which does @settitle
:
def@settitle{begin{center}%
baselineskip14p@relax
bfseries
uppercasenonmath@title
@title
end{center}%
}
OK, we should look at uppercasenonmath
:
newcommand{uppercasenonmath}[1]{toks@@emptytoks
@xp@skipmath@xp@empty#1$$%
edef#1{{@nxprotect@nx@upprepthetoks@}}%
}
This only expands @title
once, so at the end the primitive uppercase
is applied to mytitle
(it would be a bit long to go into the details). However the class also has
AtBeginDocument{%
@ifundefined{MakeTextUppercase}{}{letuppercasenonmathaltucnm}%
}
and we find
defaltucnm#1{%
MakeTextUppercase{toks@{#1}}%
edef#1{thetoks@}%
}
and this is much better, because MakeTextUppercase
does full (protected) expansion of its argument, so your mytitle
gets expanded before uppercasing is done.
edited 37 mins ago
answered 56 mins ago
egreg
709k8618833166
709k8618833166
Thank you, this solved the problem. Can you tell a little bit about why this problem happened in the first place and how textcase fixed it?
– M. Winter
53 mins ago
@M.Winter Added some details
– egreg
37 mins ago
add a comment |
Thank you, this solved the problem. Can you tell a little bit about why this problem happened in the first place and how textcase fixed it?
– M. Winter
53 mins ago
@M.Winter Added some details
– egreg
37 mins ago
Thank you, this solved the problem. Can you tell a little bit about why this problem happened in the first place and how textcase fixed it?
– M. Winter
53 mins ago
Thank you, this solved the problem. Can you tell a little bit about why this problem happened in the first place and how textcase fixed it?
– M. Winter
53 mins ago
@M.Winter Added some details
– egreg
37 mins ago
@M.Winter Added some details
– egreg
37 mins ago
add a comment |
Too long for a comment
expandafterexpandafterexpandaftertitleexpandafterexpandafterexpandafter[expandaftermytitleexpandafter]expandafter{mytitle}
But @egreg answer is worthwile reading too. :)
Wow, this is insanity. I mean I triedexpandafter
, but I was not aware that just using more might fix the problem :D
– M. Winter
21 mins ago
eh eh... you usually need them by groups of2^n -1
heren=2
because we need to expand once two things.
– jfbu
19 mins ago
add a comment |
Too long for a comment
expandafterexpandafterexpandaftertitleexpandafterexpandafterexpandafter[expandaftermytitleexpandafter]expandafter{mytitle}
But @egreg answer is worthwile reading too. :)
Wow, this is insanity. I mean I triedexpandafter
, but I was not aware that just using more might fix the problem :D
– M. Winter
21 mins ago
eh eh... you usually need them by groups of2^n -1
heren=2
because we need to expand once two things.
– jfbu
19 mins ago
add a comment |
Too long for a comment
expandafterexpandafterexpandaftertitleexpandafterexpandafterexpandafter[expandaftermytitleexpandafter]expandafter{mytitle}
But @egreg answer is worthwile reading too. :)
Too long for a comment
expandafterexpandafterexpandaftertitleexpandafterexpandafterexpandafter[expandaftermytitleexpandafter]expandafter{mytitle}
But @egreg answer is worthwile reading too. :)
answered 22 mins ago
jfbu
46.1k66148
46.1k66148
Wow, this is insanity. I mean I triedexpandafter
, but I was not aware that just using more might fix the problem :D
– M. Winter
21 mins ago
eh eh... you usually need them by groups of2^n -1
heren=2
because we need to expand once two things.
– jfbu
19 mins ago
add a comment |
Wow, this is insanity. I mean I triedexpandafter
, but I was not aware that just using more might fix the problem :D
– M. Winter
21 mins ago
eh eh... you usually need them by groups of2^n -1
heren=2
because we need to expand once two things.
– jfbu
19 mins ago
Wow, this is insanity. I mean I tried
expandafter
, but I was not aware that just using more might fix the problem :D– M. Winter
21 mins ago
Wow, this is insanity. I mean I tried
expandafter
, but I was not aware that just using more might fix the problem :D– M. Winter
21 mins ago
eh eh... you usually need them by groups of
2^n -1
here n=2
because we need to expand once two things.– jfbu
19 mins ago
eh eh... you usually need them by groups of
2^n -1
here n=2
because we need to expand once two things.– jfbu
19 mins ago
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f468245%2fhow-to-fix-this-capitalization-issue-of-a-macro-in-the-title-command%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
expandaftertitleexpandafter{mytitle}
should work.– Ulrike Fischer
1 hour ago
@UlrikeFischer I tried this, and unformtunately it does not work.
– M. Winter
54 mins ago