Using different fonts for theorem label in header












0















In the accepted answer to Put current theorem-like item's name/number in header it's shown how to put the label of the current theorem in the header. Is there a way to use two different fonts for the 'Theorem x.y' and the '(optional theorem name)' parts of the theorem label. I'd like to use scshape for the former and normalfont for the latter. I tried messing with the code but I get errors, specifically



Argument of @begintheorem has an extra}.


when I try to use textsc, and



Missing control sequence inserted.


when I use scshape or normalfont.










share|improve this question























  • If you post a MWE, or at least what you have, we’d be better able to figure out what’s going on.

    – Davislor
    Feb 8 at 20:29
















0















In the accepted answer to Put current theorem-like item's name/number in header it's shown how to put the label of the current theorem in the header. Is there a way to use two different fonts for the 'Theorem x.y' and the '(optional theorem name)' parts of the theorem label. I'd like to use scshape for the former and normalfont for the latter. I tried messing with the code but I get errors, specifically



Argument of @begintheorem has an extra}.


when I try to use textsc, and



Missing control sequence inserted.


when I use scshape or normalfont.










share|improve this question























  • If you post a MWE, or at least what you have, we’d be better able to figure out what’s going on.

    – Davislor
    Feb 8 at 20:29














0












0








0








In the accepted answer to Put current theorem-like item's name/number in header it's shown how to put the label of the current theorem in the header. Is there a way to use two different fonts for the 'Theorem x.y' and the '(optional theorem name)' parts of the theorem label. I'd like to use scshape for the former and normalfont for the latter. I tried messing with the code but I get errors, specifically



Argument of @begintheorem has an extra}.


when I try to use textsc, and



Missing control sequence inserted.


when I use scshape or normalfont.










share|improve this question














In the accepted answer to Put current theorem-like item's name/number in header it's shown how to put the label of the current theorem in the header. Is there a way to use two different fonts for the 'Theorem x.y' and the '(optional theorem name)' parts of the theorem label. I'd like to use scshape for the former and normalfont for the latter. I tried messing with the code but I get errors, specifically



Argument of @begintheorem has an extra}.


when I try to use textsc, and



Missing control sequence inserted.


when I use scshape or normalfont.







header-footer amsmath fancyhdr theorems






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 8 at 16:20









noibenoibe

32010




32010













  • If you post a MWE, or at least what you have, we’d be better able to figure out what’s going on.

    – Davislor
    Feb 8 at 20:29



















  • If you post a MWE, or at least what you have, we’d be better able to figure out what’s going on.

    – Davislor
    Feb 8 at 20:29

















If you post a MWE, or at least what you have, we’d be better able to figure out what’s going on.

– Davislor
Feb 8 at 20:29





If you post a MWE, or at least what you have, we’d be better able to figure out what’s going on.

– Davislor
Feb 8 at 20:29










2 Answers
2






active

oldest

votes


















1














In a comment to my answer to the original question, the OP explained that this question actually asks how to have the references to the theorem titles included in the running heads atop pages use the same fonts as those used in the titles themselves (that is, in the text body). I think that this is a typographic mistake, and that changes in the fonts of the running heads should be avoided, but anyway…



The following compilable example shows how to patch the code of my other answer so as to obtain what the OP asks for:



documentclass[a4paper,twoside]{article}
usepackage[T1]{fontenc} % Not necessary, but recommended.
usepackage{etoolbox}

usepackage{amsthm} % comment or uncomment as you prefer
usepackage{amsfonts} % for "mathbb"

usepackage{fancyhdr}
usepackage{lipsum}

fancyhf{}
fancyhead[RO]{(Normal font?) thepage} % show that the font for the rest
fancyhead[LE]{thepage (Normal font?)} % of the header is not affected
% fancyhead[LE,RO]{thepage} % this one should be used for the real thing
fancyhead[RE,LO]{myBotmark} % "RE" just for testing purposes
pagestyle{fancy}

newtheorem{theorem}{Theorem}[section] % or "[chapter]", or whatever
newtheorem{lemma} {Lemma} [section]

% A little trick to make this example work both with amsthm and without it;
% once you've made your choice, you do not need this code.
makeatletter
@ifdefinableIfAmsThm{}
@ifpackageloaded{amsthm}{
let IfAmsThm = @firstoftwo
}{
let IfAmsThm = @secondoftwo
}
makeatother

IfAmsThm{
newtheorem*{spclaim}{Special Claim}
swapnumbers
theoremstyle{definition}
}{}

newtheorem{defin}{Definition}[section]



%%%%%%%% BEGIN WIZARDRY %%%%%%%%

makeatletter

@ifdefinable@my@claim@mark{newmarks@my@claim@mark}
newcommand*myMark[1]{% <<< MODIFIED
begingroup
letlabelrelax letindexrelax letglossaryrelax
letprotect@unexpandable@protect
marks@my@claim@mark{#1}%
endgroup
}
newcommand*myBotmark{botmarks@my@claim@mark}

typeout{****************************************}
@ifpackageloaded{amsthm}{iftrue}{iffalse}
newcommand*my@direct@mark[3]{%
myMark{% <<< MODIFIED
{thethm@headfont % _should_ be expanded
thmname{#1}%
thmnumber{thmname{ }#2}%
thmnote{ {thethm@notefont (#3)}}% as above
}%
}%
}
newcommand*my@swapped@mark[3]{%
myMark{% <<< MODIFIED
{thethm@headfont
thmnumber{#2}%
thmname{thmnumber{ }#1}%
thmnote{ {thethm@notefont (#3)}}%
}%
}%
}
patchcmd{@begintheorem}{% search for:
thm@swapswappedheadthmhead % more specific than before
}{% replace with:
thm@swapmy@swapped@markmy@direct@mark{#1}{#2}{#3}%
thm@swapswappedheadthmhead
}{% execute if succeeded:
typeout{>>> Made patch specific for amsthm.}
}{% execute if failed:
typeout{>>> Patch specific for amsthm FAILED!}
}
else
apptocmd{@begintheorem} {myMark{#1 #2}ignorespaces}{}{}
apptocmd{@opargbegintheorem}{myMark{%
#1 #2%
(#3)% comment this line to leave Mickey Mouse out
ignorespaces
}}{}{}
typeout{>>> Made generic patch.}
fi
typeout{****************************************}

makeatother

%%%%%%%% END WIZARDRY %%%%%%%%



begin{document}

section{First section}

lipsum[1]

begin{theorem}
This is the first theorem of the first section.
end{theorem}

lipsum[2]

begin{theorem}
This is the second theorem of the first section.
end{theorem}

begin{theorem}[Donald Duck and~$mathbb{Q}$]
The third theorem of the first section.
end{theorem}

IfAmsThm{
begin{spclaim}
This is a special claim.
end{spclaim}
}{}

% begingroup
% showboxbreadth = 1000
% showboxdepth = 10
% tracingonline = 1
% showlists
% endgroup

lipsum[3-16]

begin{theorem}
This is the fourth theorem of the first section.
end{theorem}

begin{defin}[Something new]
This is the first definition of the first section.
end{defin}

begin{defin}
This is the second definition of the first section.
end{defin}

lipsum[17]

begin{lemma}
This is the first lemma of the first section.
end{lemma}

lipsum[18]

begin{theorem}
This is the fifth theorem of the first section.
end{theorem}

lipsum[19-20]

begin{lemma}[Uncle Scrooge and~$mathbb{R}$]
The second lemma of the first section.
end{lemma}

lipsum[21-32]

begin{theorem}
This is the sixth theorem of the first section.
end{theorem}

lipsum[33-36]

begin{theorem}
This is the seventh theorem of the first section.
end{theorem}

begin{lemma}
This is the third lemma of the first section.
end{lemma}

begin{theorem}[Mickey Mouse and~$mathbb{C}$]
The eighth theorem of the first section.
end{theorem}

lipsum[37-40]

begin{theorem}
This is the ninth theorem of the first section.
end{theorem}

lipsum[41-48]

begin{defin}
This is the third definition of the first section.
end{defin}

lipsum[49-64]

begin{theorem}[The last one]
This is the tenth theorem of the first section.
end{theorem}

lipsum[65-80]

begin{lemma}
This is the fourth lemma of the first section.
end{lemma}

begin{lemma}
This is the fifth lemma of the first section.
end{lemma}

begin{lemma}
This is the sixth lemma of the first section.
end{lemma}

begin{lemma}
This is the seventh lemma of the first section.
end{lemma}

begin{lemma}
This is the eighth lemma of the first section.
end{lemma}

begin{lemma}
This is the ninth lemma of the first section.
end{lemma}

begin{lemma}[Deep breath]
This is the tenth lemma of the first section.
end{lemma}

lipsum[81-84]

begin{lemma}
This is the eleventh lemma of the first section.
end{lemma}

begin{lemma}
This is the twelfth lemma of the first section.
end{lemma}

begin{lemma}
This is the thirteenth lemma of the first section.
end{lemma}

begin{lemma}
This is the fourteenth lemma of the first section.
end{lemma}

begin{lemma}
This is the fifteenth lemma of the first section.
end{lemma}

begin{lemma}[Hexadecimal deep breath]
This is the sixteenth lemma of the first section.
end{lemma}

% lipsum[85-96]

end{document}


Note that thethm@headfont and thethm@notefont should reflect the state of affairs at the time at which the theorem title is typest, so they must be expanded when the myMark command is issued.






share|improve this answer


























  • thanks a lot :)

    – noibe
    Feb 9 at 23:07



















1














Use the newtheoremstyle command of amsthm. There are other options, including the ntheorem package.



documentclass[varwidth, preview]{standalone}
usepackage[T1]{fontenc}
usepackage{amsmath, amsthm}
usepackage{newpxtext, newpxmath}

newtheorem{axiom}{Axiom}

newtheoremstyle{funkytheorem}%
{}{}%
{itshape}{}%
{bfseriesscshape}{.}%
{ }%
{thmname{#1}thmnumber{ #2}thmnote{{normalfont (#3)}}}

theoremstyle{funkytheorem}

newtheorem{colaxiom}[axiom]{Corollary}

begin{document}
begin{axiom}
(A = A).
end{axiom}

begin{colaxiom}[Corollary Axiom]
(B = B).
end{colaxiom}
end{document}


Theorem style sample



Any font package that (unlike the default) contains bold small caps will work for this example. It would also be possible to load fontspec (and even to create fake-bold small caps for Latin Modern if you want).






share|improve this answer

























    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
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f473951%2fusing-different-fonts-for-theorem-label-in-header%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









    1














    In a comment to my answer to the original question, the OP explained that this question actually asks how to have the references to the theorem titles included in the running heads atop pages use the same fonts as those used in the titles themselves (that is, in the text body). I think that this is a typographic mistake, and that changes in the fonts of the running heads should be avoided, but anyway…



    The following compilable example shows how to patch the code of my other answer so as to obtain what the OP asks for:



    documentclass[a4paper,twoside]{article}
    usepackage[T1]{fontenc} % Not necessary, but recommended.
    usepackage{etoolbox}

    usepackage{amsthm} % comment or uncomment as you prefer
    usepackage{amsfonts} % for "mathbb"

    usepackage{fancyhdr}
    usepackage{lipsum}

    fancyhf{}
    fancyhead[RO]{(Normal font?) thepage} % show that the font for the rest
    fancyhead[LE]{thepage (Normal font?)} % of the header is not affected
    % fancyhead[LE,RO]{thepage} % this one should be used for the real thing
    fancyhead[RE,LO]{myBotmark} % "RE" just for testing purposes
    pagestyle{fancy}

    newtheorem{theorem}{Theorem}[section] % or "[chapter]", or whatever
    newtheorem{lemma} {Lemma} [section]

    % A little trick to make this example work both with amsthm and without it;
    % once you've made your choice, you do not need this code.
    makeatletter
    @ifdefinableIfAmsThm{}
    @ifpackageloaded{amsthm}{
    let IfAmsThm = @firstoftwo
    }{
    let IfAmsThm = @secondoftwo
    }
    makeatother

    IfAmsThm{
    newtheorem*{spclaim}{Special Claim}
    swapnumbers
    theoremstyle{definition}
    }{}

    newtheorem{defin}{Definition}[section]



    %%%%%%%% BEGIN WIZARDRY %%%%%%%%

    makeatletter

    @ifdefinable@my@claim@mark{newmarks@my@claim@mark}
    newcommand*myMark[1]{% <<< MODIFIED
    begingroup
    letlabelrelax letindexrelax letglossaryrelax
    letprotect@unexpandable@protect
    marks@my@claim@mark{#1}%
    endgroup
    }
    newcommand*myBotmark{botmarks@my@claim@mark}

    typeout{****************************************}
    @ifpackageloaded{amsthm}{iftrue}{iffalse}
    newcommand*my@direct@mark[3]{%
    myMark{% <<< MODIFIED
    {thethm@headfont % _should_ be expanded
    thmname{#1}%
    thmnumber{thmname{ }#2}%
    thmnote{ {thethm@notefont (#3)}}% as above
    }%
    }%
    }
    newcommand*my@swapped@mark[3]{%
    myMark{% <<< MODIFIED
    {thethm@headfont
    thmnumber{#2}%
    thmname{thmnumber{ }#1}%
    thmnote{ {thethm@notefont (#3)}}%
    }%
    }%
    }
    patchcmd{@begintheorem}{% search for:
    thm@swapswappedheadthmhead % more specific than before
    }{% replace with:
    thm@swapmy@swapped@markmy@direct@mark{#1}{#2}{#3}%
    thm@swapswappedheadthmhead
    }{% execute if succeeded:
    typeout{>>> Made patch specific for amsthm.}
    }{% execute if failed:
    typeout{>>> Patch specific for amsthm FAILED!}
    }
    else
    apptocmd{@begintheorem} {myMark{#1 #2}ignorespaces}{}{}
    apptocmd{@opargbegintheorem}{myMark{%
    #1 #2%
    (#3)% comment this line to leave Mickey Mouse out
    ignorespaces
    }}{}{}
    typeout{>>> Made generic patch.}
    fi
    typeout{****************************************}

    makeatother

    %%%%%%%% END WIZARDRY %%%%%%%%



    begin{document}

    section{First section}

    lipsum[1]

    begin{theorem}
    This is the first theorem of the first section.
    end{theorem}

    lipsum[2]

    begin{theorem}
    This is the second theorem of the first section.
    end{theorem}

    begin{theorem}[Donald Duck and~$mathbb{Q}$]
    The third theorem of the first section.
    end{theorem}

    IfAmsThm{
    begin{spclaim}
    This is a special claim.
    end{spclaim}
    }{}

    % begingroup
    % showboxbreadth = 1000
    % showboxdepth = 10
    % tracingonline = 1
    % showlists
    % endgroup

    lipsum[3-16]

    begin{theorem}
    This is the fourth theorem of the first section.
    end{theorem}

    begin{defin}[Something new]
    This is the first definition of the first section.
    end{defin}

    begin{defin}
    This is the second definition of the first section.
    end{defin}

    lipsum[17]

    begin{lemma}
    This is the first lemma of the first section.
    end{lemma}

    lipsum[18]

    begin{theorem}
    This is the fifth theorem of the first section.
    end{theorem}

    lipsum[19-20]

    begin{lemma}[Uncle Scrooge and~$mathbb{R}$]
    The second lemma of the first section.
    end{lemma}

    lipsum[21-32]

    begin{theorem}
    This is the sixth theorem of the first section.
    end{theorem}

    lipsum[33-36]

    begin{theorem}
    This is the seventh theorem of the first section.
    end{theorem}

    begin{lemma}
    This is the third lemma of the first section.
    end{lemma}

    begin{theorem}[Mickey Mouse and~$mathbb{C}$]
    The eighth theorem of the first section.
    end{theorem}

    lipsum[37-40]

    begin{theorem}
    This is the ninth theorem of the first section.
    end{theorem}

    lipsum[41-48]

    begin{defin}
    This is the third definition of the first section.
    end{defin}

    lipsum[49-64]

    begin{theorem}[The last one]
    This is the tenth theorem of the first section.
    end{theorem}

    lipsum[65-80]

    begin{lemma}
    This is the fourth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the fifth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the sixth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the seventh lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the eighth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the ninth lemma of the first section.
    end{lemma}

    begin{lemma}[Deep breath]
    This is the tenth lemma of the first section.
    end{lemma}

    lipsum[81-84]

    begin{lemma}
    This is the eleventh lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the twelfth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the thirteenth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the fourteenth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the fifteenth lemma of the first section.
    end{lemma}

    begin{lemma}[Hexadecimal deep breath]
    This is the sixteenth lemma of the first section.
    end{lemma}

    % lipsum[85-96]

    end{document}


    Note that thethm@headfont and thethm@notefont should reflect the state of affairs at the time at which the theorem title is typest, so they must be expanded when the myMark command is issued.






    share|improve this answer


























    • thanks a lot :)

      – noibe
      Feb 9 at 23:07
















    1














    In a comment to my answer to the original question, the OP explained that this question actually asks how to have the references to the theorem titles included in the running heads atop pages use the same fonts as those used in the titles themselves (that is, in the text body). I think that this is a typographic mistake, and that changes in the fonts of the running heads should be avoided, but anyway…



    The following compilable example shows how to patch the code of my other answer so as to obtain what the OP asks for:



    documentclass[a4paper,twoside]{article}
    usepackage[T1]{fontenc} % Not necessary, but recommended.
    usepackage{etoolbox}

    usepackage{amsthm} % comment or uncomment as you prefer
    usepackage{amsfonts} % for "mathbb"

    usepackage{fancyhdr}
    usepackage{lipsum}

    fancyhf{}
    fancyhead[RO]{(Normal font?) thepage} % show that the font for the rest
    fancyhead[LE]{thepage (Normal font?)} % of the header is not affected
    % fancyhead[LE,RO]{thepage} % this one should be used for the real thing
    fancyhead[RE,LO]{myBotmark} % "RE" just for testing purposes
    pagestyle{fancy}

    newtheorem{theorem}{Theorem}[section] % or "[chapter]", or whatever
    newtheorem{lemma} {Lemma} [section]

    % A little trick to make this example work both with amsthm and without it;
    % once you've made your choice, you do not need this code.
    makeatletter
    @ifdefinableIfAmsThm{}
    @ifpackageloaded{amsthm}{
    let IfAmsThm = @firstoftwo
    }{
    let IfAmsThm = @secondoftwo
    }
    makeatother

    IfAmsThm{
    newtheorem*{spclaim}{Special Claim}
    swapnumbers
    theoremstyle{definition}
    }{}

    newtheorem{defin}{Definition}[section]



    %%%%%%%% BEGIN WIZARDRY %%%%%%%%

    makeatletter

    @ifdefinable@my@claim@mark{newmarks@my@claim@mark}
    newcommand*myMark[1]{% <<< MODIFIED
    begingroup
    letlabelrelax letindexrelax letglossaryrelax
    letprotect@unexpandable@protect
    marks@my@claim@mark{#1}%
    endgroup
    }
    newcommand*myBotmark{botmarks@my@claim@mark}

    typeout{****************************************}
    @ifpackageloaded{amsthm}{iftrue}{iffalse}
    newcommand*my@direct@mark[3]{%
    myMark{% <<< MODIFIED
    {thethm@headfont % _should_ be expanded
    thmname{#1}%
    thmnumber{thmname{ }#2}%
    thmnote{ {thethm@notefont (#3)}}% as above
    }%
    }%
    }
    newcommand*my@swapped@mark[3]{%
    myMark{% <<< MODIFIED
    {thethm@headfont
    thmnumber{#2}%
    thmname{thmnumber{ }#1}%
    thmnote{ {thethm@notefont (#3)}}%
    }%
    }%
    }
    patchcmd{@begintheorem}{% search for:
    thm@swapswappedheadthmhead % more specific than before
    }{% replace with:
    thm@swapmy@swapped@markmy@direct@mark{#1}{#2}{#3}%
    thm@swapswappedheadthmhead
    }{% execute if succeeded:
    typeout{>>> Made patch specific for amsthm.}
    }{% execute if failed:
    typeout{>>> Patch specific for amsthm FAILED!}
    }
    else
    apptocmd{@begintheorem} {myMark{#1 #2}ignorespaces}{}{}
    apptocmd{@opargbegintheorem}{myMark{%
    #1 #2%
    (#3)% comment this line to leave Mickey Mouse out
    ignorespaces
    }}{}{}
    typeout{>>> Made generic patch.}
    fi
    typeout{****************************************}

    makeatother

    %%%%%%%% END WIZARDRY %%%%%%%%



    begin{document}

    section{First section}

    lipsum[1]

    begin{theorem}
    This is the first theorem of the first section.
    end{theorem}

    lipsum[2]

    begin{theorem}
    This is the second theorem of the first section.
    end{theorem}

    begin{theorem}[Donald Duck and~$mathbb{Q}$]
    The third theorem of the first section.
    end{theorem}

    IfAmsThm{
    begin{spclaim}
    This is a special claim.
    end{spclaim}
    }{}

    % begingroup
    % showboxbreadth = 1000
    % showboxdepth = 10
    % tracingonline = 1
    % showlists
    % endgroup

    lipsum[3-16]

    begin{theorem}
    This is the fourth theorem of the first section.
    end{theorem}

    begin{defin}[Something new]
    This is the first definition of the first section.
    end{defin}

    begin{defin}
    This is the second definition of the first section.
    end{defin}

    lipsum[17]

    begin{lemma}
    This is the first lemma of the first section.
    end{lemma}

    lipsum[18]

    begin{theorem}
    This is the fifth theorem of the first section.
    end{theorem}

    lipsum[19-20]

    begin{lemma}[Uncle Scrooge and~$mathbb{R}$]
    The second lemma of the first section.
    end{lemma}

    lipsum[21-32]

    begin{theorem}
    This is the sixth theorem of the first section.
    end{theorem}

    lipsum[33-36]

    begin{theorem}
    This is the seventh theorem of the first section.
    end{theorem}

    begin{lemma}
    This is the third lemma of the first section.
    end{lemma}

    begin{theorem}[Mickey Mouse and~$mathbb{C}$]
    The eighth theorem of the first section.
    end{theorem}

    lipsum[37-40]

    begin{theorem}
    This is the ninth theorem of the first section.
    end{theorem}

    lipsum[41-48]

    begin{defin}
    This is the third definition of the first section.
    end{defin}

    lipsum[49-64]

    begin{theorem}[The last one]
    This is the tenth theorem of the first section.
    end{theorem}

    lipsum[65-80]

    begin{lemma}
    This is the fourth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the fifth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the sixth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the seventh lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the eighth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the ninth lemma of the first section.
    end{lemma}

    begin{lemma}[Deep breath]
    This is the tenth lemma of the first section.
    end{lemma}

    lipsum[81-84]

    begin{lemma}
    This is the eleventh lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the twelfth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the thirteenth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the fourteenth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the fifteenth lemma of the first section.
    end{lemma}

    begin{lemma}[Hexadecimal deep breath]
    This is the sixteenth lemma of the first section.
    end{lemma}

    % lipsum[85-96]

    end{document}


    Note that thethm@headfont and thethm@notefont should reflect the state of affairs at the time at which the theorem title is typest, so they must be expanded when the myMark command is issued.






    share|improve this answer


























    • thanks a lot :)

      – noibe
      Feb 9 at 23:07














    1












    1








    1







    In a comment to my answer to the original question, the OP explained that this question actually asks how to have the references to the theorem titles included in the running heads atop pages use the same fonts as those used in the titles themselves (that is, in the text body). I think that this is a typographic mistake, and that changes in the fonts of the running heads should be avoided, but anyway…



    The following compilable example shows how to patch the code of my other answer so as to obtain what the OP asks for:



    documentclass[a4paper,twoside]{article}
    usepackage[T1]{fontenc} % Not necessary, but recommended.
    usepackage{etoolbox}

    usepackage{amsthm} % comment or uncomment as you prefer
    usepackage{amsfonts} % for "mathbb"

    usepackage{fancyhdr}
    usepackage{lipsum}

    fancyhf{}
    fancyhead[RO]{(Normal font?) thepage} % show that the font for the rest
    fancyhead[LE]{thepage (Normal font?)} % of the header is not affected
    % fancyhead[LE,RO]{thepage} % this one should be used for the real thing
    fancyhead[RE,LO]{myBotmark} % "RE" just for testing purposes
    pagestyle{fancy}

    newtheorem{theorem}{Theorem}[section] % or "[chapter]", or whatever
    newtheorem{lemma} {Lemma} [section]

    % A little trick to make this example work both with amsthm and without it;
    % once you've made your choice, you do not need this code.
    makeatletter
    @ifdefinableIfAmsThm{}
    @ifpackageloaded{amsthm}{
    let IfAmsThm = @firstoftwo
    }{
    let IfAmsThm = @secondoftwo
    }
    makeatother

    IfAmsThm{
    newtheorem*{spclaim}{Special Claim}
    swapnumbers
    theoremstyle{definition}
    }{}

    newtheorem{defin}{Definition}[section]



    %%%%%%%% BEGIN WIZARDRY %%%%%%%%

    makeatletter

    @ifdefinable@my@claim@mark{newmarks@my@claim@mark}
    newcommand*myMark[1]{% <<< MODIFIED
    begingroup
    letlabelrelax letindexrelax letglossaryrelax
    letprotect@unexpandable@protect
    marks@my@claim@mark{#1}%
    endgroup
    }
    newcommand*myBotmark{botmarks@my@claim@mark}

    typeout{****************************************}
    @ifpackageloaded{amsthm}{iftrue}{iffalse}
    newcommand*my@direct@mark[3]{%
    myMark{% <<< MODIFIED
    {thethm@headfont % _should_ be expanded
    thmname{#1}%
    thmnumber{thmname{ }#2}%
    thmnote{ {thethm@notefont (#3)}}% as above
    }%
    }%
    }
    newcommand*my@swapped@mark[3]{%
    myMark{% <<< MODIFIED
    {thethm@headfont
    thmnumber{#2}%
    thmname{thmnumber{ }#1}%
    thmnote{ {thethm@notefont (#3)}}%
    }%
    }%
    }
    patchcmd{@begintheorem}{% search for:
    thm@swapswappedheadthmhead % more specific than before
    }{% replace with:
    thm@swapmy@swapped@markmy@direct@mark{#1}{#2}{#3}%
    thm@swapswappedheadthmhead
    }{% execute if succeeded:
    typeout{>>> Made patch specific for amsthm.}
    }{% execute if failed:
    typeout{>>> Patch specific for amsthm FAILED!}
    }
    else
    apptocmd{@begintheorem} {myMark{#1 #2}ignorespaces}{}{}
    apptocmd{@opargbegintheorem}{myMark{%
    #1 #2%
    (#3)% comment this line to leave Mickey Mouse out
    ignorespaces
    }}{}{}
    typeout{>>> Made generic patch.}
    fi
    typeout{****************************************}

    makeatother

    %%%%%%%% END WIZARDRY %%%%%%%%



    begin{document}

    section{First section}

    lipsum[1]

    begin{theorem}
    This is the first theorem of the first section.
    end{theorem}

    lipsum[2]

    begin{theorem}
    This is the second theorem of the first section.
    end{theorem}

    begin{theorem}[Donald Duck and~$mathbb{Q}$]
    The third theorem of the first section.
    end{theorem}

    IfAmsThm{
    begin{spclaim}
    This is a special claim.
    end{spclaim}
    }{}

    % begingroup
    % showboxbreadth = 1000
    % showboxdepth = 10
    % tracingonline = 1
    % showlists
    % endgroup

    lipsum[3-16]

    begin{theorem}
    This is the fourth theorem of the first section.
    end{theorem}

    begin{defin}[Something new]
    This is the first definition of the first section.
    end{defin}

    begin{defin}
    This is the second definition of the first section.
    end{defin}

    lipsum[17]

    begin{lemma}
    This is the first lemma of the first section.
    end{lemma}

    lipsum[18]

    begin{theorem}
    This is the fifth theorem of the first section.
    end{theorem}

    lipsum[19-20]

    begin{lemma}[Uncle Scrooge and~$mathbb{R}$]
    The second lemma of the first section.
    end{lemma}

    lipsum[21-32]

    begin{theorem}
    This is the sixth theorem of the first section.
    end{theorem}

    lipsum[33-36]

    begin{theorem}
    This is the seventh theorem of the first section.
    end{theorem}

    begin{lemma}
    This is the third lemma of the first section.
    end{lemma}

    begin{theorem}[Mickey Mouse and~$mathbb{C}$]
    The eighth theorem of the first section.
    end{theorem}

    lipsum[37-40]

    begin{theorem}
    This is the ninth theorem of the first section.
    end{theorem}

    lipsum[41-48]

    begin{defin}
    This is the third definition of the first section.
    end{defin}

    lipsum[49-64]

    begin{theorem}[The last one]
    This is the tenth theorem of the first section.
    end{theorem}

    lipsum[65-80]

    begin{lemma}
    This is the fourth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the fifth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the sixth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the seventh lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the eighth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the ninth lemma of the first section.
    end{lemma}

    begin{lemma}[Deep breath]
    This is the tenth lemma of the first section.
    end{lemma}

    lipsum[81-84]

    begin{lemma}
    This is the eleventh lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the twelfth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the thirteenth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the fourteenth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the fifteenth lemma of the first section.
    end{lemma}

    begin{lemma}[Hexadecimal deep breath]
    This is the sixteenth lemma of the first section.
    end{lemma}

    % lipsum[85-96]

    end{document}


    Note that thethm@headfont and thethm@notefont should reflect the state of affairs at the time at which the theorem title is typest, so they must be expanded when the myMark command is issued.






    share|improve this answer















    In a comment to my answer to the original question, the OP explained that this question actually asks how to have the references to the theorem titles included in the running heads atop pages use the same fonts as those used in the titles themselves (that is, in the text body). I think that this is a typographic mistake, and that changes in the fonts of the running heads should be avoided, but anyway…



    The following compilable example shows how to patch the code of my other answer so as to obtain what the OP asks for:



    documentclass[a4paper,twoside]{article}
    usepackage[T1]{fontenc} % Not necessary, but recommended.
    usepackage{etoolbox}

    usepackage{amsthm} % comment or uncomment as you prefer
    usepackage{amsfonts} % for "mathbb"

    usepackage{fancyhdr}
    usepackage{lipsum}

    fancyhf{}
    fancyhead[RO]{(Normal font?) thepage} % show that the font for the rest
    fancyhead[LE]{thepage (Normal font?)} % of the header is not affected
    % fancyhead[LE,RO]{thepage} % this one should be used for the real thing
    fancyhead[RE,LO]{myBotmark} % "RE" just for testing purposes
    pagestyle{fancy}

    newtheorem{theorem}{Theorem}[section] % or "[chapter]", or whatever
    newtheorem{lemma} {Lemma} [section]

    % A little trick to make this example work both with amsthm and without it;
    % once you've made your choice, you do not need this code.
    makeatletter
    @ifdefinableIfAmsThm{}
    @ifpackageloaded{amsthm}{
    let IfAmsThm = @firstoftwo
    }{
    let IfAmsThm = @secondoftwo
    }
    makeatother

    IfAmsThm{
    newtheorem*{spclaim}{Special Claim}
    swapnumbers
    theoremstyle{definition}
    }{}

    newtheorem{defin}{Definition}[section]



    %%%%%%%% BEGIN WIZARDRY %%%%%%%%

    makeatletter

    @ifdefinable@my@claim@mark{newmarks@my@claim@mark}
    newcommand*myMark[1]{% <<< MODIFIED
    begingroup
    letlabelrelax letindexrelax letglossaryrelax
    letprotect@unexpandable@protect
    marks@my@claim@mark{#1}%
    endgroup
    }
    newcommand*myBotmark{botmarks@my@claim@mark}

    typeout{****************************************}
    @ifpackageloaded{amsthm}{iftrue}{iffalse}
    newcommand*my@direct@mark[3]{%
    myMark{% <<< MODIFIED
    {thethm@headfont % _should_ be expanded
    thmname{#1}%
    thmnumber{thmname{ }#2}%
    thmnote{ {thethm@notefont (#3)}}% as above
    }%
    }%
    }
    newcommand*my@swapped@mark[3]{%
    myMark{% <<< MODIFIED
    {thethm@headfont
    thmnumber{#2}%
    thmname{thmnumber{ }#1}%
    thmnote{ {thethm@notefont (#3)}}%
    }%
    }%
    }
    patchcmd{@begintheorem}{% search for:
    thm@swapswappedheadthmhead % more specific than before
    }{% replace with:
    thm@swapmy@swapped@markmy@direct@mark{#1}{#2}{#3}%
    thm@swapswappedheadthmhead
    }{% execute if succeeded:
    typeout{>>> Made patch specific for amsthm.}
    }{% execute if failed:
    typeout{>>> Patch specific for amsthm FAILED!}
    }
    else
    apptocmd{@begintheorem} {myMark{#1 #2}ignorespaces}{}{}
    apptocmd{@opargbegintheorem}{myMark{%
    #1 #2%
    (#3)% comment this line to leave Mickey Mouse out
    ignorespaces
    }}{}{}
    typeout{>>> Made generic patch.}
    fi
    typeout{****************************************}

    makeatother

    %%%%%%%% END WIZARDRY %%%%%%%%



    begin{document}

    section{First section}

    lipsum[1]

    begin{theorem}
    This is the first theorem of the first section.
    end{theorem}

    lipsum[2]

    begin{theorem}
    This is the second theorem of the first section.
    end{theorem}

    begin{theorem}[Donald Duck and~$mathbb{Q}$]
    The third theorem of the first section.
    end{theorem}

    IfAmsThm{
    begin{spclaim}
    This is a special claim.
    end{spclaim}
    }{}

    % begingroup
    % showboxbreadth = 1000
    % showboxdepth = 10
    % tracingonline = 1
    % showlists
    % endgroup

    lipsum[3-16]

    begin{theorem}
    This is the fourth theorem of the first section.
    end{theorem}

    begin{defin}[Something new]
    This is the first definition of the first section.
    end{defin}

    begin{defin}
    This is the second definition of the first section.
    end{defin}

    lipsum[17]

    begin{lemma}
    This is the first lemma of the first section.
    end{lemma}

    lipsum[18]

    begin{theorem}
    This is the fifth theorem of the first section.
    end{theorem}

    lipsum[19-20]

    begin{lemma}[Uncle Scrooge and~$mathbb{R}$]
    The second lemma of the first section.
    end{lemma}

    lipsum[21-32]

    begin{theorem}
    This is the sixth theorem of the first section.
    end{theorem}

    lipsum[33-36]

    begin{theorem}
    This is the seventh theorem of the first section.
    end{theorem}

    begin{lemma}
    This is the third lemma of the first section.
    end{lemma}

    begin{theorem}[Mickey Mouse and~$mathbb{C}$]
    The eighth theorem of the first section.
    end{theorem}

    lipsum[37-40]

    begin{theorem}
    This is the ninth theorem of the first section.
    end{theorem}

    lipsum[41-48]

    begin{defin}
    This is the third definition of the first section.
    end{defin}

    lipsum[49-64]

    begin{theorem}[The last one]
    This is the tenth theorem of the first section.
    end{theorem}

    lipsum[65-80]

    begin{lemma}
    This is the fourth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the fifth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the sixth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the seventh lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the eighth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the ninth lemma of the first section.
    end{lemma}

    begin{lemma}[Deep breath]
    This is the tenth lemma of the first section.
    end{lemma}

    lipsum[81-84]

    begin{lemma}
    This is the eleventh lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the twelfth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the thirteenth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the fourteenth lemma of the first section.
    end{lemma}

    begin{lemma}
    This is the fifteenth lemma of the first section.
    end{lemma}

    begin{lemma}[Hexadecimal deep breath]
    This is the sixteenth lemma of the first section.
    end{lemma}

    % lipsum[85-96]

    end{document}


    Note that thethm@headfont and thethm@notefont should reflect the state of affairs at the time at which the theorem title is typest, so they must be expanded when the myMark command is issued.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Feb 10 at 0:42

























    answered Feb 9 at 19:24









    GuMGuM

    16.6k2457




    16.6k2457













    • thanks a lot :)

      – noibe
      Feb 9 at 23:07



















    • thanks a lot :)

      – noibe
      Feb 9 at 23:07

















    thanks a lot :)

    – noibe
    Feb 9 at 23:07





    thanks a lot :)

    – noibe
    Feb 9 at 23:07











    1














    Use the newtheoremstyle command of amsthm. There are other options, including the ntheorem package.



    documentclass[varwidth, preview]{standalone}
    usepackage[T1]{fontenc}
    usepackage{amsmath, amsthm}
    usepackage{newpxtext, newpxmath}

    newtheorem{axiom}{Axiom}

    newtheoremstyle{funkytheorem}%
    {}{}%
    {itshape}{}%
    {bfseriesscshape}{.}%
    { }%
    {thmname{#1}thmnumber{ #2}thmnote{{normalfont (#3)}}}

    theoremstyle{funkytheorem}

    newtheorem{colaxiom}[axiom]{Corollary}

    begin{document}
    begin{axiom}
    (A = A).
    end{axiom}

    begin{colaxiom}[Corollary Axiom]
    (B = B).
    end{colaxiom}
    end{document}


    Theorem style sample



    Any font package that (unlike the default) contains bold small caps will work for this example. It would also be possible to load fontspec (and even to create fake-bold small caps for Latin Modern if you want).






    share|improve this answer






























      1














      Use the newtheoremstyle command of amsthm. There are other options, including the ntheorem package.



      documentclass[varwidth, preview]{standalone}
      usepackage[T1]{fontenc}
      usepackage{amsmath, amsthm}
      usepackage{newpxtext, newpxmath}

      newtheorem{axiom}{Axiom}

      newtheoremstyle{funkytheorem}%
      {}{}%
      {itshape}{}%
      {bfseriesscshape}{.}%
      { }%
      {thmname{#1}thmnumber{ #2}thmnote{{normalfont (#3)}}}

      theoremstyle{funkytheorem}

      newtheorem{colaxiom}[axiom]{Corollary}

      begin{document}
      begin{axiom}
      (A = A).
      end{axiom}

      begin{colaxiom}[Corollary Axiom]
      (B = B).
      end{colaxiom}
      end{document}


      Theorem style sample



      Any font package that (unlike the default) contains bold small caps will work for this example. It would also be possible to load fontspec (and even to create fake-bold small caps for Latin Modern if you want).






      share|improve this answer




























        1












        1








        1







        Use the newtheoremstyle command of amsthm. There are other options, including the ntheorem package.



        documentclass[varwidth, preview]{standalone}
        usepackage[T1]{fontenc}
        usepackage{amsmath, amsthm}
        usepackage{newpxtext, newpxmath}

        newtheorem{axiom}{Axiom}

        newtheoremstyle{funkytheorem}%
        {}{}%
        {itshape}{}%
        {bfseriesscshape}{.}%
        { }%
        {thmname{#1}thmnumber{ #2}thmnote{{normalfont (#3)}}}

        theoremstyle{funkytheorem}

        newtheorem{colaxiom}[axiom]{Corollary}

        begin{document}
        begin{axiom}
        (A = A).
        end{axiom}

        begin{colaxiom}[Corollary Axiom]
        (B = B).
        end{colaxiom}
        end{document}


        Theorem style sample



        Any font package that (unlike the default) contains bold small caps will work for this example. It would also be possible to load fontspec (and even to create fake-bold small caps for Latin Modern if you want).






        share|improve this answer















        Use the newtheoremstyle command of amsthm. There are other options, including the ntheorem package.



        documentclass[varwidth, preview]{standalone}
        usepackage[T1]{fontenc}
        usepackage{amsmath, amsthm}
        usepackage{newpxtext, newpxmath}

        newtheorem{axiom}{Axiom}

        newtheoremstyle{funkytheorem}%
        {}{}%
        {itshape}{}%
        {bfseriesscshape}{.}%
        { }%
        {thmname{#1}thmnumber{ #2}thmnote{{normalfont (#3)}}}

        theoremstyle{funkytheorem}

        newtheorem{colaxiom}[axiom]{Corollary}

        begin{document}
        begin{axiom}
        (A = A).
        end{axiom}

        begin{colaxiom}[Corollary Axiom]
        (B = B).
        end{colaxiom}
        end{document}


        Theorem style sample



        Any font package that (unlike the default) contains bold small caps will work for this example. It would also be possible to load fontspec (and even to create fake-bold small caps for Latin Modern if you want).







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Feb 8 at 21:33

























        answered Feb 8 at 21:07









        DavislorDavislor

        6,3811328




        6,3811328






























            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f473951%2fusing-different-fonts-for-theorem-label-in-header%23new-answer', 'question_page');
            }
            );

            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







            Popular posts from this blog

            Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

            ComboBox Display Member on multiple fields

            Is it possible to collect Nectar points via Trainline?