This is based on David Carlisle's answer to your earlier question.
It can handle paragraphs and offers key-value customisation. My approach is based on three styles rather than two: a common style applied before each of the init and alt styles. This makes it possible to define the common style to be empty, so the changes are cumulative, or to reset everything in between. By default, common resets both font style and size, init uses italics and alt uses bold.
This can be changed globally and/or locally.
Syntax:
\astroalt[<key-value options>]{<text>}
\astroaltset{<key-value options>}
where the available keys are:
init=<font switches>
alt=<font switches>
common=<font switches>
init sets the style of the initial word and every other thereafter. alt sets the style of alternate words. common is applied to all words before the styles set by init or alt.
Use \astroaltset{} to set default values indefinitely. Use the optional argument to \astroalt[]{} to set one-off changes.
% addaswyd o ateb David Carlisle: https://tex.stackexchange.com/a/213427/
\documentclass{article}
\usepackage{xparse,kantlipsum}
\ExplSyntaxOn
\NewDocumentCommand \astroalt { o +m }
{
\IfValueT { #1 }
{
\keys_set:nn { astro / alting } { #1 }
}
\astro_alt:n { #2 }
}
\NewDocumentCommand \astroaltset { m }
{
\keys_set:nn { astro / alting } { #1 }
}
\keys_define:nn { astro / alting }
{
alt .tl_set:N = \l_astro_alt_tl,
alt .initial:n = { \itshape },
common .tl_set:N = \l_astro_common_tl,
common .initial:n = { \normalfont\normalsize },
init .tl_set:N = \l_astro_init_tl,
init .initial:n = { \bfseries },
}
\tl_new:N \l_astro_alternate_tl
\bool_new:N \l_astro_alt_bool
\bool_set_false:N \l_astro_alt_bool
\cs_set_protected:Npn \astro_alt:n #1
{
\group_begin:
\bool_set_false:N \l_astro_alt_bool
\astro_format:
\tl_set:Nn \l_astro_alternate_tl { #1 }
\tl_replace_all:Nnn \l_astro_alternate_tl {~} { ~ \astro_format: }
\tl_use:N \l_astro_alternate_tl
\group_end:
}
\cs_new_protected:Nn \astro_format:
{
\bool_if:NTF \l_astro_alt_bool
{
\l_astro_common_tl
\l_astro_alt_tl
\bool_set_false:N \l_astro_alt_bool
}
{
\l_astro_common_tl
\l_astro_init_tl
\bool_set_true:N \l_astro_alt_bool
}
}
\ExplSyntaxOff
\newcommand\kanttest{%
\astroalt{% from kantlipsum
As any dedicated reader can clearly see, the Ideal of practical reason is a representation of, as far as I know, the things in themselves;
as I have shown elsewhere, the phenomena should only be used as
a canon for our understanding. The paralogisms of practical reason
are what first give rise to the architectonic of practical reason. As
will easily be shown in the next section, reason would thereby be
made to contradict, in view of these considerations, the Ideal of practical reason, yet the manifold depends on the phenomena. Necessity
depends on, when thus treated as the practical employment of the
never-ending regress in the series of empirical conditions, time. Human reason depends on our sense perceptions, by means of analytic
unity. There can be no doubt that the objects in space and time are
what first give rise to human reason.
Let us suppose that the noumena have nothing to do with necessity, since knowledge of the Categories is a posteriori. Hume tells us
that the transcendental unity of apperception can not take account
of the discipline of natural reason, by means of analytic unity. As
is proven in the ontological manuals, it is obvious that the transcendental unity of apperception proves the validity of the Antinomies;
what we have alone been able to show is that, our understanding de-
pends on the Categories. It remains a mystery why the Ideal stands
in need of reason. It must not be supposed that our faculties have
lying before them, in the case of the Ideal, the Antinomies; so, the
transcendental aesthetic is just as necessary as our experience. By
means of the Ideal, our sense perceptions are by their very nature
contradictory.
}%
}
\begin{document}
\astroalt{%
Here is some text.
Here is some more.%
}
\astroalt[alt=\scshape]{%
Here was some stuff.
But there is no more.%
}
\astroaltset{%
init=\sffamily,
alt=\footnotesize,
common=\normalfont\normalsize\bfseries,
}
\kanttest
\end{document}
