There are several page styles in a document, and I want to change the appearance of some paragraphs if the page style they appear on is, say, plain, with a macro of roughly the following form:
\def\plainpagestyle{plain}
\def\someparagraph#1{
\ifx???\currentpagestyle???\plainpagestyle
\textbf{#1}
\else
\textit{#1}
\fi
}
so that \someparagraph{some text} renders "some text" in bold on plain pages and in italics elsewhere.
More specifically, I want the appearance of some paragraphs to change on pages a part or a chapter or other things like this begin, so always after \thispagestyle{plain} is declared on the page.
Is there a nice way to do it?
\pagestyledoes not record its argument, it is not known which page a text will land on at the point that fonts are used to typeset the text. – David Carlisle Dec 19 '23 at 20:47\thispagestylewas declared to beplainon the same page the paragraph initially starts, and if it ends up on the next page, it's ok, pretty much like\thepagedoesn't update until a new paragraph starts. – Sergey Slyusarev Dec 19 '23 at 21:07the\thispagestylecommand takes an argument like\pagestyleand just works for one page, If\thispagestylewas used the argument is recorded in@specialstylebut if\pagestyle` was used the argument is not recorded at all. – David Carlisle Dec 19 '23 at 21:13\paragraphs) on pages with\partso are you actually just trying to change something on the first page (and maybe a bit later) of chapters? – cfr Dec 19 '23 at 21:29plain). In such a case section titles do appear. The latter happens in the beginning of the book's parts (or chapters), which, in case of this particular book, do contain text and normally have sections starting right below the part/chapter titles. In the past I solved this problem by simply making two versions of section macros, but I want to make it automatic and more flexible. – Sergey Slyusarev Dec 19 '23 at 21:51\thispagestyleand\pagestylework, and tried poking\@specialstyle, to no avail. My only idea right now is to record\thepageat the end of the\partdefinition and compare it to\thepageat the beginning of the paragraph in question, but maybe there's a better way. – Sergey Slyusarev Dec 19 '23 at 21:58\@specialpagestylewill be defined to beplainbut you really shouldn't be testing for that. – David Carlisle Dec 19 '23 at 22:02\part, at least. Yet you've not provided any example which might hint at what you're doing. If you use customised pages, you could include a call to LaTeX's hooks there and use that mechanism to switch the definitions. Withfancyhdr, for example, you could change the definition in, say,fancyplainand include a hook there to revert the change when the page is shipped out. Then ensure\chapter,\partetc. usefancyplainrather thanplain. (I'm assuming you want regularplainsomewhere.) – cfr Dec 20 '23 at 03:21