Automatically formatting mesostics

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












5















A mesostic is poem/text similar to an acrostic except the "spine word" runs down the middle. Wiki's article explains it ok.



The format was pioneered by the composer John Cage and as the years went on he added more rules and began to use it to "write through" large texts (like Walden) generating hundreds or more mesostic poems. Eventually he got some people to mostly automate the process via software.



I've created my own mesostic generator. Here is an example that it produced using Poe's The Raven with the spine word "Lenore":



 nearLy napping, 
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.


This can be achieved, roughly, with the following code:



documentclass[11pt]memoir
usepackagefancyvrb
usepackageDejaVuSansMono
begindocument
beginVerbatim[xleftmargin=-35mm,commandchars=\]
neartextbfLy napping,
camtextbfE a
tappitextbfNg,
as textbfOf
gently textbfRapping,
at my chambtextbfEr door.
endVerbatim
enddocument


My mesostic generator is written in Lua and automatically adds enough spaces on the left to get the spine to line up down the center (plus I add the bold face stuff).



This works wonderfully for monospaced fonts. When I look through Cage's books I see he uses proportional fonts and yet still retains the formatting with the spine running perfectly down the center. I'm guessing that this was done manually by the typesetter.



So I'm wondering if anyone has any ideas about how to automatically format mesostics using proportional fonts within TeX/LaTeX?



Couple of notes:



  1. A solution in LuaLaTeX would be fine.


  2. In Cage's and my mesostics, all the letters are converted to lowercase with only the spine letters in caps. This is something that might be used to help format things?


  3. Cage's rules limit the total number of characters in a line to 90 or so (45 character limit on either side of the spine letter). I follow this in my software. In fact I change the font size automatically when the lines get long.










share|improve this question
























  • Can't you use a tabular with 3 columns (and no space between the columns)?

    – Ulrike Fischer
    Jan 19 at 21:15











  • I'm assuming that you mean the left "wing words" would be in one column on the left, the spine letter in a column in the middle, and then the right wing words in a third column on the right. And then just center the middle column and add the other columns? My concern would be that you'd lose some typesetting beauty by not having the letters on either side of the spine letter be properly and automatically spaced.

    – bfootdav
    Jan 19 at 21:21











  • It should be not so difficult to insert the kerning manually.

    – Ulrike Fischer
    Jan 19 at 21:31











  • I have no idea how one would automate inserting the kerning. I'm also not sure how one would go about centering one column of three on a page.

    – bfootdav
    Jan 19 at 21:42















5















A mesostic is poem/text similar to an acrostic except the "spine word" runs down the middle. Wiki's article explains it ok.



The format was pioneered by the composer John Cage and as the years went on he added more rules and began to use it to "write through" large texts (like Walden) generating hundreds or more mesostic poems. Eventually he got some people to mostly automate the process via software.



I've created my own mesostic generator. Here is an example that it produced using Poe's The Raven with the spine word "Lenore":



 nearLy napping, 
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.


This can be achieved, roughly, with the following code:



documentclass[11pt]memoir
usepackagefancyvrb
usepackageDejaVuSansMono
begindocument
beginVerbatim[xleftmargin=-35mm,commandchars=\]
neartextbfLy napping,
camtextbfE a
tappitextbfNg,
as textbfOf
gently textbfRapping,
at my chambtextbfEr door.
endVerbatim
enddocument


My mesostic generator is written in Lua and automatically adds enough spaces on the left to get the spine to line up down the center (plus I add the bold face stuff).



This works wonderfully for monospaced fonts. When I look through Cage's books I see he uses proportional fonts and yet still retains the formatting with the spine running perfectly down the center. I'm guessing that this was done manually by the typesetter.



So I'm wondering if anyone has any ideas about how to automatically format mesostics using proportional fonts within TeX/LaTeX?



Couple of notes:



  1. A solution in LuaLaTeX would be fine.


  2. In Cage's and my mesostics, all the letters are converted to lowercase with only the spine letters in caps. This is something that might be used to help format things?


  3. Cage's rules limit the total number of characters in a line to 90 or so (45 character limit on either side of the spine letter). I follow this in my software. In fact I change the font size automatically when the lines get long.










share|improve this question
























  • Can't you use a tabular with 3 columns (and no space between the columns)?

    – Ulrike Fischer
    Jan 19 at 21:15











  • I'm assuming that you mean the left "wing words" would be in one column on the left, the spine letter in a column in the middle, and then the right wing words in a third column on the right. And then just center the middle column and add the other columns? My concern would be that you'd lose some typesetting beauty by not having the letters on either side of the spine letter be properly and automatically spaced.

    – bfootdav
    Jan 19 at 21:21











  • It should be not so difficult to insert the kerning manually.

    – Ulrike Fischer
    Jan 19 at 21:31











  • I have no idea how one would automate inserting the kerning. I'm also not sure how one would go about centering one column of three on a page.

    – bfootdav
    Jan 19 at 21:42













5












5








5


2






A mesostic is poem/text similar to an acrostic except the "spine word" runs down the middle. Wiki's article explains it ok.



The format was pioneered by the composer John Cage and as the years went on he added more rules and began to use it to "write through" large texts (like Walden) generating hundreds or more mesostic poems. Eventually he got some people to mostly automate the process via software.



I've created my own mesostic generator. Here is an example that it produced using Poe's The Raven with the spine word "Lenore":



 nearLy napping, 
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.


This can be achieved, roughly, with the following code:



documentclass[11pt]memoir
usepackagefancyvrb
usepackageDejaVuSansMono
begindocument
beginVerbatim[xleftmargin=-35mm,commandchars=\]
neartextbfLy napping,
camtextbfE a
tappitextbfNg,
as textbfOf
gently textbfRapping,
at my chambtextbfEr door.
endVerbatim
enddocument


My mesostic generator is written in Lua and automatically adds enough spaces on the left to get the spine to line up down the center (plus I add the bold face stuff).



This works wonderfully for monospaced fonts. When I look through Cage's books I see he uses proportional fonts and yet still retains the formatting with the spine running perfectly down the center. I'm guessing that this was done manually by the typesetter.



So I'm wondering if anyone has any ideas about how to automatically format mesostics using proportional fonts within TeX/LaTeX?



Couple of notes:



  1. A solution in LuaLaTeX would be fine.


  2. In Cage's and my mesostics, all the letters are converted to lowercase with only the spine letters in caps. This is something that might be used to help format things?


  3. Cage's rules limit the total number of characters in a line to 90 or so (45 character limit on either side of the spine letter). I follow this in my software. In fact I change the font size automatically when the lines get long.










share|improve this question
















A mesostic is poem/text similar to an acrostic except the "spine word" runs down the middle. Wiki's article explains it ok.



The format was pioneered by the composer John Cage and as the years went on he added more rules and began to use it to "write through" large texts (like Walden) generating hundreds or more mesostic poems. Eventually he got some people to mostly automate the process via software.



I've created my own mesostic generator. Here is an example that it produced using Poe's The Raven with the spine word "Lenore":



 nearLy napping, 
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.


This can be achieved, roughly, with the following code:



documentclass[11pt]memoir
usepackagefancyvrb
usepackageDejaVuSansMono
begindocument
beginVerbatim[xleftmargin=-35mm,commandchars=\]
neartextbfLy napping,
camtextbfE a
tappitextbfNg,
as textbfOf
gently textbfRapping,
at my chambtextbfEr door.
endVerbatim
enddocument


My mesostic generator is written in Lua and automatically adds enough spaces on the left to get the spine to line up down the center (plus I add the bold face stuff).



This works wonderfully for monospaced fonts. When I look through Cage's books I see he uses proportional fonts and yet still retains the formatting with the spine running perfectly down the center. I'm guessing that this was done manually by the typesetter.



So I'm wondering if anyone has any ideas about how to automatically format mesostics using proportional fonts within TeX/LaTeX?



Couple of notes:



  1. A solution in LuaLaTeX would be fine.


  2. In Cage's and my mesostics, all the letters are converted to lowercase with only the spine letters in caps. This is something that might be used to help format things?


  3. Cage's rules limit the total number of characters in a line to 90 or so (45 character limit on either side of the spine letter). I follow this in my software. In fact I change the font size automatically when the lines get long.







poetry mesostic






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 19 at 21:37







bfootdav

















asked Jan 19 at 20:03









bfootdavbfootdav

6481420




6481420












  • Can't you use a tabular with 3 columns (and no space between the columns)?

    – Ulrike Fischer
    Jan 19 at 21:15











  • I'm assuming that you mean the left "wing words" would be in one column on the left, the spine letter in a column in the middle, and then the right wing words in a third column on the right. And then just center the middle column and add the other columns? My concern would be that you'd lose some typesetting beauty by not having the letters on either side of the spine letter be properly and automatically spaced.

    – bfootdav
    Jan 19 at 21:21











  • It should be not so difficult to insert the kerning manually.

    – Ulrike Fischer
    Jan 19 at 21:31











  • I have no idea how one would automate inserting the kerning. I'm also not sure how one would go about centering one column of three on a page.

    – bfootdav
    Jan 19 at 21:42

















  • Can't you use a tabular with 3 columns (and no space between the columns)?

    – Ulrike Fischer
    Jan 19 at 21:15











  • I'm assuming that you mean the left "wing words" would be in one column on the left, the spine letter in a column in the middle, and then the right wing words in a third column on the right. And then just center the middle column and add the other columns? My concern would be that you'd lose some typesetting beauty by not having the letters on either side of the spine letter be properly and automatically spaced.

    – bfootdav
    Jan 19 at 21:21











  • It should be not so difficult to insert the kerning manually.

    – Ulrike Fischer
    Jan 19 at 21:31











  • I have no idea how one would automate inserting the kerning. I'm also not sure how one would go about centering one column of three on a page.

    – bfootdav
    Jan 19 at 21:42
















Can't you use a tabular with 3 columns (and no space between the columns)?

– Ulrike Fischer
Jan 19 at 21:15





Can't you use a tabular with 3 columns (and no space between the columns)?

– Ulrike Fischer
Jan 19 at 21:15













I'm assuming that you mean the left "wing words" would be in one column on the left, the spine letter in a column in the middle, and then the right wing words in a third column on the right. And then just center the middle column and add the other columns? My concern would be that you'd lose some typesetting beauty by not having the letters on either side of the spine letter be properly and automatically spaced.

– bfootdav
Jan 19 at 21:21





I'm assuming that you mean the left "wing words" would be in one column on the left, the spine letter in a column in the middle, and then the right wing words in a third column on the right. And then just center the middle column and add the other columns? My concern would be that you'd lose some typesetting beauty by not having the letters on either side of the spine letter be properly and automatically spaced.

– bfootdav
Jan 19 at 21:21













It should be not so difficult to insert the kerning manually.

– Ulrike Fischer
Jan 19 at 21:31





It should be not so difficult to insert the kerning manually.

– Ulrike Fischer
Jan 19 at 21:31













I have no idea how one would automate inserting the kerning. I'm also not sure how one would go about centering one column of three on a page.

– bfootdav
Jan 19 at 21:42





I have no idea how one would automate inserting the kerning. I'm also not sure how one would go about centering one column of three on a page.

– bfootdav
Jan 19 at 21:42










3 Answers
3






active

oldest

votes


















4














Disclaimer. The code below doesn't imply in any way whatsoever that I endorse or otherwise hold in esteem any aspect of John Cage's work.




The following approach splits the input at \, then builds lines one by one, setting an hbox where the width of the center letter is measured; the box will then consist of



  1. a box as wide as half the linewidth minus half the center letter's width, flush right;

  2. the center letter;

  3. a box like in step 1, but flush left.

documentclassarticle
usepackageenviron,xparse

usepackagekantlipsum % for context

ExplSyntaxOn
NewEnvironmesostic

paraddvspacetopsep
mesostic_build:V BODY
addvspacetopsep


seq_new:N l__mesostic_body_seq
box_new:N l__mesostic_center_box

cs_new_protected:Nn mesostic_build:n

seq_set_split:Nnn l__mesostic_body_seq \ #1
seq_map_inline:Nn l__mesostic_body_seq

__mesostic_line:w ##1 q_stop


cs_generate_variant:Nn mesostic_build:n V

cs_new_protected:Npn __mesostic_line:w #1 | #2 | #3 q_stop

hbox_set:Nn l__mesostic_center_box textbf#2
hbox_to_wd:nn linewidth

hbox_to_wd:nn (linewidth-box_wd:N l__mesostic_center_box)/2

hss #1

textbf#2
hbox_to_wd:nn (linewidth-box_wd:N l__mesostic_center_box)/2

#3 hss



ExplSyntaxOff

begindocument

kant[1]

beginmesostic
near|L|y napping, \
cam|E| a \
tappi|N|g, \
as |O|f \
gently |R|apping, \
at my chamb|E|r door.
endmesostic

kant[2]

enddocument


enter image description here



Changing the font might be implemented by making a tentative typesetting and measuring each part in order to see whether it satisfies the constraints of being contained in the line width; in case of failure, stop, change the font size and repeat.




A variant that allows for an optional argument where to state a font or a font size (or both); also a check for a trailing \ is added. The main code has been simplified (thanks to jfbu for the idea).



documentclassarticle
usepackageenviron,xparse

usepackagekantlipsum % for context

ExplSyntaxOn
NewEnvironmesostic[1]

#1
paraddvspacetopsep
mesostic_build:V BODY
addvspacetopsep


seq_new:N l__mesostic_body_seq
cs_generate_variant:Nn tl_if_empty:nT x

cs_new_protected:Nn mesostic_build:n

seq_set_split:Nnn l__mesostic_body_seq \ #1
% check for a trailing \
tl_if_empty:xT seq_item:Nn l__mesostic_body_seq -1

seq_pop_right:NN l__mesostic_body_seq l_tmpa_tl

seq_map_inline:Nn l__mesostic_body_seq

__mesostic_line:w ##1 q_stop


cs_generate_variant:Nn mesostic_build:n V

cs_new_protected:Npn __mesostic_line:w #1 | #2 | #3 q_stop

hbox_to_wd:nn linewidth

hss
hbox_to_wd:nn 0pt hss tl_lower_case:n #1
textbftl_upper_case:n #2
hbox_to_wd:nn 0pt tl_lower_case:n #3 hss
hss


ExplSyntaxOff

begindocument

kant[1]

beginmesostic
near|L|y napping, \
cam|E| a \
tappi|N|g, \
as |O|f \
gently |R|apping, \
at my chamb|E|r door.
endmesostic

kant[2]

beginmesostic[sffamilyfootnotesize]
NEAR|l|Y NAPPING \
CAM|e| A \
TAPPI|n|G \
AS |o|F \
GENTLY |r|APPING \
AT MY CHAMB|e|R DOOR \
endmesostic

kant[3]

enddocument


enter image description here






share|improve this answer

























  • Wow! Thank you very much, egreg! I've marked this as answered but I'm going to play around with it for the next few days. If any questions come up I'll ping you. This is really cool and so much more versatile than my Verbatim solution.

    – bfootdav
    Jan 19 at 22:41











  • @bfootdav Instead of doing tentative typesettings, it would be easy to add an optional argument for selecting font/size.

    – egreg
    Jan 19 at 22:45











  • The font size is handled in my mesostic generating software and works ok especially since there can only be at most 91 characters in a line. The software generates .tex files. I experimented with line lengths and chose font sizes for various line lengths. I ended up only needing two sizes anyway.

    – bfootdav
    Jan 19 at 22:50











  • everything is working extremely well, thanks! I have one question that is not from my original post. And if it can't be done/is too onerous don't worry about it because it's not that big of a deal. Your version allows me to do some interesting experimentation with various typographic features in the text including changing the font size on a per letter basis. I've noticed that the spine letters (the ones in caps) appear to be centered relative to their table box. Is it possible to have them print flush left instead? I've looked at your code and have been unable to figure it out.

    – bfootdav
    Jan 22 at 4:44












  • @bfootdav In this case, I guess that the left side of the bounding box should be at the page center.

    – egreg
    Jan 22 at 7:48


















3














documentclassarticle

makeatletter
defmesostic@endendmesostic
begingroupcatcode`^^Mactive
gdefmesostic@aux#1|#2|#3mesostic@aux%
noindenthfill%
llapMakeLowercase#1%
textbfMakeUppercase#2%
rlapMakeLowercase#3%
hfillhboxpar%
expandafter^^M%
endgroup
newenvironmentmesosticparskip0ptrelax
obeylines
begingrouplccode`~`^^M
lowercaseendgroupdef~##1~%
defmesostic@tmp##1%
ifxmesostic@tmpmesostic@end
expandaftermesostic@end
else
mesostic@aux##1mesostic@aux
fi%

makeatother

begindocument

blah blah blah

noindent Xdotfill X

beginmesostic
near|L|y napping,
cam|E| a
tappi|N|g,
as |O|f
gently |R|apping,
at my chamb|E|r door.
endmesostic

noindent Xdotfill X

blah blah blah

noindent Xdotfill X

beginmesostic
NEAR|l|Y NAPPING,
CAM|e| A
TAPPI|n|G,
AS |o|F
GENTLY |r|APPING,
AT MY CHAMB|e|R DOOR.
endmesostic


noindent Xdotfill X

blah blah blah

enddocument


enter image description here



And using Xdotfill Xdotfill X for the extra lines for context:



enter image description here






share|improve this answer

























  • of course the input can be kept in the indented form aligning the letters; I deliberately flushed it to the left to show freedom of input.

    – user4686
    Jan 19 at 22:55












  • I also illustrated the uppercasing, which seems to have been on OP's list.

    – user4686
    Jan 19 at 23:04


















3














enter image description here



 documentclassarticle

makeatletter
letzzfonttextbf
obeylineseveryeofnoexpand%
gdefzzz#1%
catcode`#1activescantokensdefzzzzgdef#1%
zzzz##1^^Mmakebox[.5textwidth][l]zzfontstring#1##1par%

defzzflushrightobeylines%
letorzzz@Alph0fiiftrue%

defendzzendflushright
begindocument

beginzz
nearLy napping,
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.
endzz

renewcommandzzfont[1]large$mathcal#1$
beginzz
nearLy napping,
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.
endzz


enddocument





share|improve this answer

























  • It looks like the letters to the right of the spine letter are also being bolded. Also, at least as I've implemented it in my software, whether to bold the spine letter is an option.

    – bfootdav
    Jan 19 at 23:29











  • @bfootdav sorry about that, just middle letter now bold and I made that font customisable so you could make it do nothing or pick a fancier font or whatever

    – David Carlisle
    Jan 19 at 23:46











  • brilliant! But I am sure you get intro trouble as soon as you switch to a real language, like French or German. (try ÉGALITÉ e.g)

    – user4686
    Jan 20 at 8:02












  • not for "chipoter" but your central letters are not exactly centered on line...

    – user4686
    Jan 20 at 8:09











  • @jfbu I know, actually their left edge is on the center. You could define the zzfont command to center it's argument in say an M box if that were needed, but I thought the spacing looked better this way.

    – David Carlisle
    Jan 20 at 9:56










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%2f470926%2fautomatically-formatting-mesostics%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























3 Answers
3






active

oldest

votes








3 Answers
3






active

oldest

votes









active

oldest

votes






active

oldest

votes









4














Disclaimer. The code below doesn't imply in any way whatsoever that I endorse or otherwise hold in esteem any aspect of John Cage's work.




The following approach splits the input at \, then builds lines one by one, setting an hbox where the width of the center letter is measured; the box will then consist of



  1. a box as wide as half the linewidth minus half the center letter's width, flush right;

  2. the center letter;

  3. a box like in step 1, but flush left.

documentclassarticle
usepackageenviron,xparse

usepackagekantlipsum % for context

ExplSyntaxOn
NewEnvironmesostic

paraddvspacetopsep
mesostic_build:V BODY
addvspacetopsep


seq_new:N l__mesostic_body_seq
box_new:N l__mesostic_center_box

cs_new_protected:Nn mesostic_build:n

seq_set_split:Nnn l__mesostic_body_seq \ #1
seq_map_inline:Nn l__mesostic_body_seq

__mesostic_line:w ##1 q_stop


cs_generate_variant:Nn mesostic_build:n V

cs_new_protected:Npn __mesostic_line:w #1 | #2 | #3 q_stop

hbox_set:Nn l__mesostic_center_box textbf#2
hbox_to_wd:nn linewidth

hbox_to_wd:nn (linewidth-box_wd:N l__mesostic_center_box)/2

hss #1

textbf#2
hbox_to_wd:nn (linewidth-box_wd:N l__mesostic_center_box)/2

#3 hss



ExplSyntaxOff

begindocument

kant[1]

beginmesostic
near|L|y napping, \
cam|E| a \
tappi|N|g, \
as |O|f \
gently |R|apping, \
at my chamb|E|r door.
endmesostic

kant[2]

enddocument


enter image description here



Changing the font might be implemented by making a tentative typesetting and measuring each part in order to see whether it satisfies the constraints of being contained in the line width; in case of failure, stop, change the font size and repeat.




A variant that allows for an optional argument where to state a font or a font size (or both); also a check for a trailing \ is added. The main code has been simplified (thanks to jfbu for the idea).



documentclassarticle
usepackageenviron,xparse

usepackagekantlipsum % for context

ExplSyntaxOn
NewEnvironmesostic[1]

#1
paraddvspacetopsep
mesostic_build:V BODY
addvspacetopsep


seq_new:N l__mesostic_body_seq
cs_generate_variant:Nn tl_if_empty:nT x

cs_new_protected:Nn mesostic_build:n

seq_set_split:Nnn l__mesostic_body_seq \ #1
% check for a trailing \
tl_if_empty:xT seq_item:Nn l__mesostic_body_seq -1

seq_pop_right:NN l__mesostic_body_seq l_tmpa_tl

seq_map_inline:Nn l__mesostic_body_seq

__mesostic_line:w ##1 q_stop


cs_generate_variant:Nn mesostic_build:n V

cs_new_protected:Npn __mesostic_line:w #1 | #2 | #3 q_stop

hbox_to_wd:nn linewidth

hss
hbox_to_wd:nn 0pt hss tl_lower_case:n #1
textbftl_upper_case:n #2
hbox_to_wd:nn 0pt tl_lower_case:n #3 hss
hss


ExplSyntaxOff

begindocument

kant[1]

beginmesostic
near|L|y napping, \
cam|E| a \
tappi|N|g, \
as |O|f \
gently |R|apping, \
at my chamb|E|r door.
endmesostic

kant[2]

beginmesostic[sffamilyfootnotesize]
NEAR|l|Y NAPPING \
CAM|e| A \
TAPPI|n|G \
AS |o|F \
GENTLY |r|APPING \
AT MY CHAMB|e|R DOOR \
endmesostic

kant[3]

enddocument


enter image description here






share|improve this answer

























  • Wow! Thank you very much, egreg! I've marked this as answered but I'm going to play around with it for the next few days. If any questions come up I'll ping you. This is really cool and so much more versatile than my Verbatim solution.

    – bfootdav
    Jan 19 at 22:41











  • @bfootdav Instead of doing tentative typesettings, it would be easy to add an optional argument for selecting font/size.

    – egreg
    Jan 19 at 22:45











  • The font size is handled in my mesostic generating software and works ok especially since there can only be at most 91 characters in a line. The software generates .tex files. I experimented with line lengths and chose font sizes for various line lengths. I ended up only needing two sizes anyway.

    – bfootdav
    Jan 19 at 22:50











  • everything is working extremely well, thanks! I have one question that is not from my original post. And if it can't be done/is too onerous don't worry about it because it's not that big of a deal. Your version allows me to do some interesting experimentation with various typographic features in the text including changing the font size on a per letter basis. I've noticed that the spine letters (the ones in caps) appear to be centered relative to their table box. Is it possible to have them print flush left instead? I've looked at your code and have been unable to figure it out.

    – bfootdav
    Jan 22 at 4:44












  • @bfootdav In this case, I guess that the left side of the bounding box should be at the page center.

    – egreg
    Jan 22 at 7:48















4














Disclaimer. The code below doesn't imply in any way whatsoever that I endorse or otherwise hold in esteem any aspect of John Cage's work.




The following approach splits the input at \, then builds lines one by one, setting an hbox where the width of the center letter is measured; the box will then consist of



  1. a box as wide as half the linewidth minus half the center letter's width, flush right;

  2. the center letter;

  3. a box like in step 1, but flush left.

documentclassarticle
usepackageenviron,xparse

usepackagekantlipsum % for context

ExplSyntaxOn
NewEnvironmesostic

paraddvspacetopsep
mesostic_build:V BODY
addvspacetopsep


seq_new:N l__mesostic_body_seq
box_new:N l__mesostic_center_box

cs_new_protected:Nn mesostic_build:n

seq_set_split:Nnn l__mesostic_body_seq \ #1
seq_map_inline:Nn l__mesostic_body_seq

__mesostic_line:w ##1 q_stop


cs_generate_variant:Nn mesostic_build:n V

cs_new_protected:Npn __mesostic_line:w #1 | #2 | #3 q_stop

hbox_set:Nn l__mesostic_center_box textbf#2
hbox_to_wd:nn linewidth

hbox_to_wd:nn (linewidth-box_wd:N l__mesostic_center_box)/2

hss #1

textbf#2
hbox_to_wd:nn (linewidth-box_wd:N l__mesostic_center_box)/2

#3 hss



ExplSyntaxOff

begindocument

kant[1]

beginmesostic
near|L|y napping, \
cam|E| a \
tappi|N|g, \
as |O|f \
gently |R|apping, \
at my chamb|E|r door.
endmesostic

kant[2]

enddocument


enter image description here



Changing the font might be implemented by making a tentative typesetting and measuring each part in order to see whether it satisfies the constraints of being contained in the line width; in case of failure, stop, change the font size and repeat.




A variant that allows for an optional argument where to state a font or a font size (or both); also a check for a trailing \ is added. The main code has been simplified (thanks to jfbu for the idea).



documentclassarticle
usepackageenviron,xparse

usepackagekantlipsum % for context

ExplSyntaxOn
NewEnvironmesostic[1]

#1
paraddvspacetopsep
mesostic_build:V BODY
addvspacetopsep


seq_new:N l__mesostic_body_seq
cs_generate_variant:Nn tl_if_empty:nT x

cs_new_protected:Nn mesostic_build:n

seq_set_split:Nnn l__mesostic_body_seq \ #1
% check for a trailing \
tl_if_empty:xT seq_item:Nn l__mesostic_body_seq -1

seq_pop_right:NN l__mesostic_body_seq l_tmpa_tl

seq_map_inline:Nn l__mesostic_body_seq

__mesostic_line:w ##1 q_stop


cs_generate_variant:Nn mesostic_build:n V

cs_new_protected:Npn __mesostic_line:w #1 | #2 | #3 q_stop

hbox_to_wd:nn linewidth

hss
hbox_to_wd:nn 0pt hss tl_lower_case:n #1
textbftl_upper_case:n #2
hbox_to_wd:nn 0pt tl_lower_case:n #3 hss
hss


ExplSyntaxOff

begindocument

kant[1]

beginmesostic
near|L|y napping, \
cam|E| a \
tappi|N|g, \
as |O|f \
gently |R|apping, \
at my chamb|E|r door.
endmesostic

kant[2]

beginmesostic[sffamilyfootnotesize]
NEAR|l|Y NAPPING \
CAM|e| A \
TAPPI|n|G \
AS |o|F \
GENTLY |r|APPING \
AT MY CHAMB|e|R DOOR \
endmesostic

kant[3]

enddocument


enter image description here






share|improve this answer

























  • Wow! Thank you very much, egreg! I've marked this as answered but I'm going to play around with it for the next few days. If any questions come up I'll ping you. This is really cool and so much more versatile than my Verbatim solution.

    – bfootdav
    Jan 19 at 22:41











  • @bfootdav Instead of doing tentative typesettings, it would be easy to add an optional argument for selecting font/size.

    – egreg
    Jan 19 at 22:45











  • The font size is handled in my mesostic generating software and works ok especially since there can only be at most 91 characters in a line. The software generates .tex files. I experimented with line lengths and chose font sizes for various line lengths. I ended up only needing two sizes anyway.

    – bfootdav
    Jan 19 at 22:50











  • everything is working extremely well, thanks! I have one question that is not from my original post. And if it can't be done/is too onerous don't worry about it because it's not that big of a deal. Your version allows me to do some interesting experimentation with various typographic features in the text including changing the font size on a per letter basis. I've noticed that the spine letters (the ones in caps) appear to be centered relative to their table box. Is it possible to have them print flush left instead? I've looked at your code and have been unable to figure it out.

    – bfootdav
    Jan 22 at 4:44












  • @bfootdav In this case, I guess that the left side of the bounding box should be at the page center.

    – egreg
    Jan 22 at 7:48













4












4








4







Disclaimer. The code below doesn't imply in any way whatsoever that I endorse or otherwise hold in esteem any aspect of John Cage's work.




The following approach splits the input at \, then builds lines one by one, setting an hbox where the width of the center letter is measured; the box will then consist of



  1. a box as wide as half the linewidth minus half the center letter's width, flush right;

  2. the center letter;

  3. a box like in step 1, but flush left.

documentclassarticle
usepackageenviron,xparse

usepackagekantlipsum % for context

ExplSyntaxOn
NewEnvironmesostic

paraddvspacetopsep
mesostic_build:V BODY
addvspacetopsep


seq_new:N l__mesostic_body_seq
box_new:N l__mesostic_center_box

cs_new_protected:Nn mesostic_build:n

seq_set_split:Nnn l__mesostic_body_seq \ #1
seq_map_inline:Nn l__mesostic_body_seq

__mesostic_line:w ##1 q_stop


cs_generate_variant:Nn mesostic_build:n V

cs_new_protected:Npn __mesostic_line:w #1 | #2 | #3 q_stop

hbox_set:Nn l__mesostic_center_box textbf#2
hbox_to_wd:nn linewidth

hbox_to_wd:nn (linewidth-box_wd:N l__mesostic_center_box)/2

hss #1

textbf#2
hbox_to_wd:nn (linewidth-box_wd:N l__mesostic_center_box)/2

#3 hss



ExplSyntaxOff

begindocument

kant[1]

beginmesostic
near|L|y napping, \
cam|E| a \
tappi|N|g, \
as |O|f \
gently |R|apping, \
at my chamb|E|r door.
endmesostic

kant[2]

enddocument


enter image description here



Changing the font might be implemented by making a tentative typesetting and measuring each part in order to see whether it satisfies the constraints of being contained in the line width; in case of failure, stop, change the font size and repeat.




A variant that allows for an optional argument where to state a font or a font size (or both); also a check for a trailing \ is added. The main code has been simplified (thanks to jfbu for the idea).



documentclassarticle
usepackageenviron,xparse

usepackagekantlipsum % for context

ExplSyntaxOn
NewEnvironmesostic[1]

#1
paraddvspacetopsep
mesostic_build:V BODY
addvspacetopsep


seq_new:N l__mesostic_body_seq
cs_generate_variant:Nn tl_if_empty:nT x

cs_new_protected:Nn mesostic_build:n

seq_set_split:Nnn l__mesostic_body_seq \ #1
% check for a trailing \
tl_if_empty:xT seq_item:Nn l__mesostic_body_seq -1

seq_pop_right:NN l__mesostic_body_seq l_tmpa_tl

seq_map_inline:Nn l__mesostic_body_seq

__mesostic_line:w ##1 q_stop


cs_generate_variant:Nn mesostic_build:n V

cs_new_protected:Npn __mesostic_line:w #1 | #2 | #3 q_stop

hbox_to_wd:nn linewidth

hss
hbox_to_wd:nn 0pt hss tl_lower_case:n #1
textbftl_upper_case:n #2
hbox_to_wd:nn 0pt tl_lower_case:n #3 hss
hss


ExplSyntaxOff

begindocument

kant[1]

beginmesostic
near|L|y napping, \
cam|E| a \
tappi|N|g, \
as |O|f \
gently |R|apping, \
at my chamb|E|r door.
endmesostic

kant[2]

beginmesostic[sffamilyfootnotesize]
NEAR|l|Y NAPPING \
CAM|e| A \
TAPPI|n|G \
AS |o|F \
GENTLY |r|APPING \
AT MY CHAMB|e|R DOOR \
endmesostic

kant[3]

enddocument


enter image description here






share|improve this answer















Disclaimer. The code below doesn't imply in any way whatsoever that I endorse or otherwise hold in esteem any aspect of John Cage's work.




The following approach splits the input at \, then builds lines one by one, setting an hbox where the width of the center letter is measured; the box will then consist of



  1. a box as wide as half the linewidth minus half the center letter's width, flush right;

  2. the center letter;

  3. a box like in step 1, but flush left.

documentclassarticle
usepackageenviron,xparse

usepackagekantlipsum % for context

ExplSyntaxOn
NewEnvironmesostic

paraddvspacetopsep
mesostic_build:V BODY
addvspacetopsep


seq_new:N l__mesostic_body_seq
box_new:N l__mesostic_center_box

cs_new_protected:Nn mesostic_build:n

seq_set_split:Nnn l__mesostic_body_seq \ #1
seq_map_inline:Nn l__mesostic_body_seq

__mesostic_line:w ##1 q_stop


cs_generate_variant:Nn mesostic_build:n V

cs_new_protected:Npn __mesostic_line:w #1 | #2 | #3 q_stop

hbox_set:Nn l__mesostic_center_box textbf#2
hbox_to_wd:nn linewidth

hbox_to_wd:nn (linewidth-box_wd:N l__mesostic_center_box)/2

hss #1

textbf#2
hbox_to_wd:nn (linewidth-box_wd:N l__mesostic_center_box)/2

#3 hss



ExplSyntaxOff

begindocument

kant[1]

beginmesostic
near|L|y napping, \
cam|E| a \
tappi|N|g, \
as |O|f \
gently |R|apping, \
at my chamb|E|r door.
endmesostic

kant[2]

enddocument


enter image description here



Changing the font might be implemented by making a tentative typesetting and measuring each part in order to see whether it satisfies the constraints of being contained in the line width; in case of failure, stop, change the font size and repeat.




A variant that allows for an optional argument where to state a font or a font size (or both); also a check for a trailing \ is added. The main code has been simplified (thanks to jfbu for the idea).



documentclassarticle
usepackageenviron,xparse

usepackagekantlipsum % for context

ExplSyntaxOn
NewEnvironmesostic[1]

#1
paraddvspacetopsep
mesostic_build:V BODY
addvspacetopsep


seq_new:N l__mesostic_body_seq
cs_generate_variant:Nn tl_if_empty:nT x

cs_new_protected:Nn mesostic_build:n

seq_set_split:Nnn l__mesostic_body_seq \ #1
% check for a trailing \
tl_if_empty:xT seq_item:Nn l__mesostic_body_seq -1

seq_pop_right:NN l__mesostic_body_seq l_tmpa_tl

seq_map_inline:Nn l__mesostic_body_seq

__mesostic_line:w ##1 q_stop


cs_generate_variant:Nn mesostic_build:n V

cs_new_protected:Npn __mesostic_line:w #1 | #2 | #3 q_stop

hbox_to_wd:nn linewidth

hss
hbox_to_wd:nn 0pt hss tl_lower_case:n #1
textbftl_upper_case:n #2
hbox_to_wd:nn 0pt tl_lower_case:n #3 hss
hss


ExplSyntaxOff

begindocument

kant[1]

beginmesostic
near|L|y napping, \
cam|E| a \
tappi|N|g, \
as |O|f \
gently |R|apping, \
at my chamb|E|r door.
endmesostic

kant[2]

beginmesostic[sffamilyfootnotesize]
NEAR|l|Y NAPPING \
CAM|e| A \
TAPPI|n|G \
AS |o|F \
GENTLY |r|APPING \
AT MY CHAMB|e|R DOOR \
endmesostic

kant[3]

enddocument


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 19 at 22:59

























answered Jan 19 at 22:14









egregegreg

718k8719023198




718k8719023198












  • Wow! Thank you very much, egreg! I've marked this as answered but I'm going to play around with it for the next few days. If any questions come up I'll ping you. This is really cool and so much more versatile than my Verbatim solution.

    – bfootdav
    Jan 19 at 22:41











  • @bfootdav Instead of doing tentative typesettings, it would be easy to add an optional argument for selecting font/size.

    – egreg
    Jan 19 at 22:45











  • The font size is handled in my mesostic generating software and works ok especially since there can only be at most 91 characters in a line. The software generates .tex files. I experimented with line lengths and chose font sizes for various line lengths. I ended up only needing two sizes anyway.

    – bfootdav
    Jan 19 at 22:50











  • everything is working extremely well, thanks! I have one question that is not from my original post. And if it can't be done/is too onerous don't worry about it because it's not that big of a deal. Your version allows me to do some interesting experimentation with various typographic features in the text including changing the font size on a per letter basis. I've noticed that the spine letters (the ones in caps) appear to be centered relative to their table box. Is it possible to have them print flush left instead? I've looked at your code and have been unable to figure it out.

    – bfootdav
    Jan 22 at 4:44












  • @bfootdav In this case, I guess that the left side of the bounding box should be at the page center.

    – egreg
    Jan 22 at 7:48

















  • Wow! Thank you very much, egreg! I've marked this as answered but I'm going to play around with it for the next few days. If any questions come up I'll ping you. This is really cool and so much more versatile than my Verbatim solution.

    – bfootdav
    Jan 19 at 22:41











  • @bfootdav Instead of doing tentative typesettings, it would be easy to add an optional argument for selecting font/size.

    – egreg
    Jan 19 at 22:45











  • The font size is handled in my mesostic generating software and works ok especially since there can only be at most 91 characters in a line. The software generates .tex files. I experimented with line lengths and chose font sizes for various line lengths. I ended up only needing two sizes anyway.

    – bfootdav
    Jan 19 at 22:50











  • everything is working extremely well, thanks! I have one question that is not from my original post. And if it can't be done/is too onerous don't worry about it because it's not that big of a deal. Your version allows me to do some interesting experimentation with various typographic features in the text including changing the font size on a per letter basis. I've noticed that the spine letters (the ones in caps) appear to be centered relative to their table box. Is it possible to have them print flush left instead? I've looked at your code and have been unable to figure it out.

    – bfootdav
    Jan 22 at 4:44












  • @bfootdav In this case, I guess that the left side of the bounding box should be at the page center.

    – egreg
    Jan 22 at 7:48
















Wow! Thank you very much, egreg! I've marked this as answered but I'm going to play around with it for the next few days. If any questions come up I'll ping you. This is really cool and so much more versatile than my Verbatim solution.

– bfootdav
Jan 19 at 22:41





Wow! Thank you very much, egreg! I've marked this as answered but I'm going to play around with it for the next few days. If any questions come up I'll ping you. This is really cool and so much more versatile than my Verbatim solution.

– bfootdav
Jan 19 at 22:41













@bfootdav Instead of doing tentative typesettings, it would be easy to add an optional argument for selecting font/size.

– egreg
Jan 19 at 22:45





@bfootdav Instead of doing tentative typesettings, it would be easy to add an optional argument for selecting font/size.

– egreg
Jan 19 at 22:45













The font size is handled in my mesostic generating software and works ok especially since there can only be at most 91 characters in a line. The software generates .tex files. I experimented with line lengths and chose font sizes for various line lengths. I ended up only needing two sizes anyway.

– bfootdav
Jan 19 at 22:50





The font size is handled in my mesostic generating software and works ok especially since there can only be at most 91 characters in a line. The software generates .tex files. I experimented with line lengths and chose font sizes for various line lengths. I ended up only needing two sizes anyway.

– bfootdav
Jan 19 at 22:50













everything is working extremely well, thanks! I have one question that is not from my original post. And if it can't be done/is too onerous don't worry about it because it's not that big of a deal. Your version allows me to do some interesting experimentation with various typographic features in the text including changing the font size on a per letter basis. I've noticed that the spine letters (the ones in caps) appear to be centered relative to their table box. Is it possible to have them print flush left instead? I've looked at your code and have been unable to figure it out.

– bfootdav
Jan 22 at 4:44






everything is working extremely well, thanks! I have one question that is not from my original post. And if it can't be done/is too onerous don't worry about it because it's not that big of a deal. Your version allows me to do some interesting experimentation with various typographic features in the text including changing the font size on a per letter basis. I've noticed that the spine letters (the ones in caps) appear to be centered relative to their table box. Is it possible to have them print flush left instead? I've looked at your code and have been unable to figure it out.

– bfootdav
Jan 22 at 4:44














@bfootdav In this case, I guess that the left side of the bounding box should be at the page center.

– egreg
Jan 22 at 7:48





@bfootdav In this case, I guess that the left side of the bounding box should be at the page center.

– egreg
Jan 22 at 7:48











3














documentclassarticle

makeatletter
defmesostic@endendmesostic
begingroupcatcode`^^Mactive
gdefmesostic@aux#1|#2|#3mesostic@aux%
noindenthfill%
llapMakeLowercase#1%
textbfMakeUppercase#2%
rlapMakeLowercase#3%
hfillhboxpar%
expandafter^^M%
endgroup
newenvironmentmesosticparskip0ptrelax
obeylines
begingrouplccode`~`^^M
lowercaseendgroupdef~##1~%
defmesostic@tmp##1%
ifxmesostic@tmpmesostic@end
expandaftermesostic@end
else
mesostic@aux##1mesostic@aux
fi%

makeatother

begindocument

blah blah blah

noindent Xdotfill X

beginmesostic
near|L|y napping,
cam|E| a
tappi|N|g,
as |O|f
gently |R|apping,
at my chamb|E|r door.
endmesostic

noindent Xdotfill X

blah blah blah

noindent Xdotfill X

beginmesostic
NEAR|l|Y NAPPING,
CAM|e| A
TAPPI|n|G,
AS |o|F
GENTLY |r|APPING,
AT MY CHAMB|e|R DOOR.
endmesostic


noindent Xdotfill X

blah blah blah

enddocument


enter image description here



And using Xdotfill Xdotfill X for the extra lines for context:



enter image description here






share|improve this answer

























  • of course the input can be kept in the indented form aligning the letters; I deliberately flushed it to the left to show freedom of input.

    – user4686
    Jan 19 at 22:55












  • I also illustrated the uppercasing, which seems to have been on OP's list.

    – user4686
    Jan 19 at 23:04















3














documentclassarticle

makeatletter
defmesostic@endendmesostic
begingroupcatcode`^^Mactive
gdefmesostic@aux#1|#2|#3mesostic@aux%
noindenthfill%
llapMakeLowercase#1%
textbfMakeUppercase#2%
rlapMakeLowercase#3%
hfillhboxpar%
expandafter^^M%
endgroup
newenvironmentmesosticparskip0ptrelax
obeylines
begingrouplccode`~`^^M
lowercaseendgroupdef~##1~%
defmesostic@tmp##1%
ifxmesostic@tmpmesostic@end
expandaftermesostic@end
else
mesostic@aux##1mesostic@aux
fi%

makeatother

begindocument

blah blah blah

noindent Xdotfill X

beginmesostic
near|L|y napping,
cam|E| a
tappi|N|g,
as |O|f
gently |R|apping,
at my chamb|E|r door.
endmesostic

noindent Xdotfill X

blah blah blah

noindent Xdotfill X

beginmesostic
NEAR|l|Y NAPPING,
CAM|e| A
TAPPI|n|G,
AS |o|F
GENTLY |r|APPING,
AT MY CHAMB|e|R DOOR.
endmesostic


noindent Xdotfill X

blah blah blah

enddocument


enter image description here



And using Xdotfill Xdotfill X for the extra lines for context:



enter image description here






share|improve this answer

























  • of course the input can be kept in the indented form aligning the letters; I deliberately flushed it to the left to show freedom of input.

    – user4686
    Jan 19 at 22:55












  • I also illustrated the uppercasing, which seems to have been on OP's list.

    – user4686
    Jan 19 at 23:04













3












3








3







documentclassarticle

makeatletter
defmesostic@endendmesostic
begingroupcatcode`^^Mactive
gdefmesostic@aux#1|#2|#3mesostic@aux%
noindenthfill%
llapMakeLowercase#1%
textbfMakeUppercase#2%
rlapMakeLowercase#3%
hfillhboxpar%
expandafter^^M%
endgroup
newenvironmentmesosticparskip0ptrelax
obeylines
begingrouplccode`~`^^M
lowercaseendgroupdef~##1~%
defmesostic@tmp##1%
ifxmesostic@tmpmesostic@end
expandaftermesostic@end
else
mesostic@aux##1mesostic@aux
fi%

makeatother

begindocument

blah blah blah

noindent Xdotfill X

beginmesostic
near|L|y napping,
cam|E| a
tappi|N|g,
as |O|f
gently |R|apping,
at my chamb|E|r door.
endmesostic

noindent Xdotfill X

blah blah blah

noindent Xdotfill X

beginmesostic
NEAR|l|Y NAPPING,
CAM|e| A
TAPPI|n|G,
AS |o|F
GENTLY |r|APPING,
AT MY CHAMB|e|R DOOR.
endmesostic


noindent Xdotfill X

blah blah blah

enddocument


enter image description here



And using Xdotfill Xdotfill X for the extra lines for context:



enter image description here






share|improve this answer















documentclassarticle

makeatletter
defmesostic@endendmesostic
begingroupcatcode`^^Mactive
gdefmesostic@aux#1|#2|#3mesostic@aux%
noindenthfill%
llapMakeLowercase#1%
textbfMakeUppercase#2%
rlapMakeLowercase#3%
hfillhboxpar%
expandafter^^M%
endgroup
newenvironmentmesosticparskip0ptrelax
obeylines
begingrouplccode`~`^^M
lowercaseendgroupdef~##1~%
defmesostic@tmp##1%
ifxmesostic@tmpmesostic@end
expandaftermesostic@end
else
mesostic@aux##1mesostic@aux
fi%

makeatother

begindocument

blah blah blah

noindent Xdotfill X

beginmesostic
near|L|y napping,
cam|E| a
tappi|N|g,
as |O|f
gently |R|apping,
at my chamb|E|r door.
endmesostic

noindent Xdotfill X

blah blah blah

noindent Xdotfill X

beginmesostic
NEAR|l|Y NAPPING,
CAM|e| A
TAPPI|n|G,
AS |o|F
GENTLY |r|APPING,
AT MY CHAMB|e|R DOOR.
endmesostic


noindent Xdotfill X

blah blah blah

enddocument


enter image description here



And using Xdotfill Xdotfill X for the extra lines for context:



enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 19 at 22:51

























answered Jan 19 at 22:45







user4686



















  • of course the input can be kept in the indented form aligning the letters; I deliberately flushed it to the left to show freedom of input.

    – user4686
    Jan 19 at 22:55












  • I also illustrated the uppercasing, which seems to have been on OP's list.

    – user4686
    Jan 19 at 23:04

















  • of course the input can be kept in the indented form aligning the letters; I deliberately flushed it to the left to show freedom of input.

    – user4686
    Jan 19 at 22:55












  • I also illustrated the uppercasing, which seems to have been on OP's list.

    – user4686
    Jan 19 at 23:04
















of course the input can be kept in the indented form aligning the letters; I deliberately flushed it to the left to show freedom of input.

– user4686
Jan 19 at 22:55






of course the input can be kept in the indented form aligning the letters; I deliberately flushed it to the left to show freedom of input.

– user4686
Jan 19 at 22:55














I also illustrated the uppercasing, which seems to have been on OP's list.

– user4686
Jan 19 at 23:04





I also illustrated the uppercasing, which seems to have been on OP's list.

– user4686
Jan 19 at 23:04











3














enter image description here



 documentclassarticle

makeatletter
letzzfonttextbf
obeylineseveryeofnoexpand%
gdefzzz#1%
catcode`#1activescantokensdefzzzzgdef#1%
zzzz##1^^Mmakebox[.5textwidth][l]zzfontstring#1##1par%

defzzflushrightobeylines%
letorzzz@Alph0fiiftrue%

defendzzendflushright
begindocument

beginzz
nearLy napping,
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.
endzz

renewcommandzzfont[1]large$mathcal#1$
beginzz
nearLy napping,
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.
endzz


enddocument





share|improve this answer

























  • It looks like the letters to the right of the spine letter are also being bolded. Also, at least as I've implemented it in my software, whether to bold the spine letter is an option.

    – bfootdav
    Jan 19 at 23:29











  • @bfootdav sorry about that, just middle letter now bold and I made that font customisable so you could make it do nothing or pick a fancier font or whatever

    – David Carlisle
    Jan 19 at 23:46











  • brilliant! But I am sure you get intro trouble as soon as you switch to a real language, like French or German. (try ÉGALITÉ e.g)

    – user4686
    Jan 20 at 8:02












  • not for "chipoter" but your central letters are not exactly centered on line...

    – user4686
    Jan 20 at 8:09











  • @jfbu I know, actually their left edge is on the center. You could define the zzfont command to center it's argument in say an M box if that were needed, but I thought the spacing looked better this way.

    – David Carlisle
    Jan 20 at 9:56















3














enter image description here



 documentclassarticle

makeatletter
letzzfonttextbf
obeylineseveryeofnoexpand%
gdefzzz#1%
catcode`#1activescantokensdefzzzzgdef#1%
zzzz##1^^Mmakebox[.5textwidth][l]zzfontstring#1##1par%

defzzflushrightobeylines%
letorzzz@Alph0fiiftrue%

defendzzendflushright
begindocument

beginzz
nearLy napping,
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.
endzz

renewcommandzzfont[1]large$mathcal#1$
beginzz
nearLy napping,
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.
endzz


enddocument





share|improve this answer

























  • It looks like the letters to the right of the spine letter are also being bolded. Also, at least as I've implemented it in my software, whether to bold the spine letter is an option.

    – bfootdav
    Jan 19 at 23:29











  • @bfootdav sorry about that, just middle letter now bold and I made that font customisable so you could make it do nothing or pick a fancier font or whatever

    – David Carlisle
    Jan 19 at 23:46











  • brilliant! But I am sure you get intro trouble as soon as you switch to a real language, like French or German. (try ÉGALITÉ e.g)

    – user4686
    Jan 20 at 8:02












  • not for "chipoter" but your central letters are not exactly centered on line...

    – user4686
    Jan 20 at 8:09











  • @jfbu I know, actually their left edge is on the center. You could define the zzfont command to center it's argument in say an M box if that were needed, but I thought the spacing looked better this way.

    – David Carlisle
    Jan 20 at 9:56













3












3








3







enter image description here



 documentclassarticle

makeatletter
letzzfonttextbf
obeylineseveryeofnoexpand%
gdefzzz#1%
catcode`#1activescantokensdefzzzzgdef#1%
zzzz##1^^Mmakebox[.5textwidth][l]zzfontstring#1##1par%

defzzflushrightobeylines%
letorzzz@Alph0fiiftrue%

defendzzendflushright
begindocument

beginzz
nearLy napping,
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.
endzz

renewcommandzzfont[1]large$mathcal#1$
beginzz
nearLy napping,
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.
endzz


enddocument





share|improve this answer















enter image description here



 documentclassarticle

makeatletter
letzzfonttextbf
obeylineseveryeofnoexpand%
gdefzzz#1%
catcode`#1activescantokensdefzzzzgdef#1%
zzzz##1^^Mmakebox[.5textwidth][l]zzfontstring#1##1par%

defzzflushrightobeylines%
letorzzz@Alph0fiiftrue%

defendzzendflushright
begindocument

beginzz
nearLy napping,
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.
endzz

renewcommandzzfont[1]large$mathcal#1$
beginzz
nearLy napping,
camE a
tappiNg,
as Of
gently Rapping,
at my chambEr door.
endzz


enddocument






share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 19 at 23:45

























answered Jan 19 at 23:21









David CarlisleDavid Carlisle

489k4111311877




489k4111311877












  • It looks like the letters to the right of the spine letter are also being bolded. Also, at least as I've implemented it in my software, whether to bold the spine letter is an option.

    – bfootdav
    Jan 19 at 23:29











  • @bfootdav sorry about that, just middle letter now bold and I made that font customisable so you could make it do nothing or pick a fancier font or whatever

    – David Carlisle
    Jan 19 at 23:46











  • brilliant! But I am sure you get intro trouble as soon as you switch to a real language, like French or German. (try ÉGALITÉ e.g)

    – user4686
    Jan 20 at 8:02












  • not for "chipoter" but your central letters are not exactly centered on line...

    – user4686
    Jan 20 at 8:09











  • @jfbu I know, actually their left edge is on the center. You could define the zzfont command to center it's argument in say an M box if that were needed, but I thought the spacing looked better this way.

    – David Carlisle
    Jan 20 at 9:56

















  • It looks like the letters to the right of the spine letter are also being bolded. Also, at least as I've implemented it in my software, whether to bold the spine letter is an option.

    – bfootdav
    Jan 19 at 23:29











  • @bfootdav sorry about that, just middle letter now bold and I made that font customisable so you could make it do nothing or pick a fancier font or whatever

    – David Carlisle
    Jan 19 at 23:46











  • brilliant! But I am sure you get intro trouble as soon as you switch to a real language, like French or German. (try ÉGALITÉ e.g)

    – user4686
    Jan 20 at 8:02












  • not for "chipoter" but your central letters are not exactly centered on line...

    – user4686
    Jan 20 at 8:09











  • @jfbu I know, actually their left edge is on the center. You could define the zzfont command to center it's argument in say an M box if that were needed, but I thought the spacing looked better this way.

    – David Carlisle
    Jan 20 at 9:56
















It looks like the letters to the right of the spine letter are also being bolded. Also, at least as I've implemented it in my software, whether to bold the spine letter is an option.

– bfootdav
Jan 19 at 23:29





It looks like the letters to the right of the spine letter are also being bolded. Also, at least as I've implemented it in my software, whether to bold the spine letter is an option.

– bfootdav
Jan 19 at 23:29













@bfootdav sorry about that, just middle letter now bold and I made that font customisable so you could make it do nothing or pick a fancier font or whatever

– David Carlisle
Jan 19 at 23:46





@bfootdav sorry about that, just middle letter now bold and I made that font customisable so you could make it do nothing or pick a fancier font or whatever

– David Carlisle
Jan 19 at 23:46













brilliant! But I am sure you get intro trouble as soon as you switch to a real language, like French or German. (try ÉGALITÉ e.g)

– user4686
Jan 20 at 8:02






brilliant! But I am sure you get intro trouble as soon as you switch to a real language, like French or German. (try ÉGALITÉ e.g)

– user4686
Jan 20 at 8:02














not for "chipoter" but your central letters are not exactly centered on line...

– user4686
Jan 20 at 8:09





not for "chipoter" but your central letters are not exactly centered on line...

– user4686
Jan 20 at 8:09













@jfbu I know, actually their left edge is on the center. You could define the zzfont command to center it's argument in say an M box if that were needed, but I thought the spacing looked better this way.

– David Carlisle
Jan 20 at 9:56





@jfbu I know, actually their left edge is on the center. You could define the zzfont command to center it's argument in say an M box if that were needed, but I thought the spacing looked better this way.

– David Carlisle
Jan 20 at 9:56

















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%2f470926%2fautomatically-formatting-mesostics%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

Peggy Mitchell

Palaiologos

The Forum (Inglewood, California)