How to write a definition with variants? The Next CEO of Stack OverflowTranslate in-line equations to TeX code (Any Package?)Doing def+asdf+texttt#1 where + can be set with a macroAllow macro to end without new lineMultiple vertical rules along text – by using leaders?How to write a parameter-driven macro?Special macro definition (2opt, 1mand)amstex: operator definition errorProblem in a macro definition (plain TeX)Write an unpar macroLaTeX for plain TeX users?“Missing '' inserted” and “Missing inserted” with aligned environment

How to get from Geneva Airport to Metabief, Doubs, France by public transport?

Why does standard notation not preserve intervals (visually)

How to prove a simple equation?

How many extra stops do monopods offer for tele photographs?

A small doubt about the dominated convergence theorem

Proper way to express "He disappeared them"

What was the first Unix version to run on a microcomputer?

Why the difference in type-inference over the as-pattern in two similar function definitions?

What connection does MS Office have to Netscape Navigator?

How to write a definition with variants?

Why is information "lost" when it got into a black hole?

I believe this to be a fraud - hired, then asked to cash check and send cash as Bitcoin

What happened in Rome, when the western empire "fell"?

Are police here, aren't itthey?

Axiom Schema vs Axiom

How to avoid supervisors with prejudiced views?

Bartok - Syncopation (1): Meaning of notes in between Grand Staff

Is it convenient to ask the journal's editor for two additional days to complete a review?

Why doesn't UK go for the same deal Japan has with EU to resolve Brexit?

Is French Guiana a (hard) EU border?

Won the lottery - how do I keep the money?

Does Germany produce more waste than the US?

Why, when going from special to general relativity, do we just replace partial derivatives with covariant derivatives?

Is there a way to save my career from absolute disaster?



How to write a definition with variants?



The Next CEO of Stack OverflowTranslate in-line equations to TeX code (Any Package?)Doing def+asdf+texttt#1 where + can be set with a macroAllow macro to end without new lineMultiple vertical rules along text – by using leaders?How to write a parameter-driven macro?Special macro definition (2opt, 1mand)amstex: operator definition errorProblem in a macro definition (plain TeX)Write an unpar macroLaTeX for plain TeX users?“Missing '' inserted” and “Missing inserted” with aligned environment










3















In TeX I can define, say



def1#1 is #2.#1 & is & #2.\



and



def2#1 has #2.#1 & has & #2.\



with an easy usage:
1 Jim Jones is a fictional character.
and
2 Tim Smith has two brothers.



This gives three columns of a tabular: Jim Jones, is, a fictional character. Similarly in the second case.



Can I write a definition depending on, in this case, is/has so I can write



3 Jim Jones is a fictional character.
and
3 Tim Smith has two brothers.



obtaing the previous results?



Solutions using Lua or expl3 are OK, but I hope that a pure TeX one is also possible.










share|improve this question
























  • At the TeX level for any def you can have only one parameter text (the #1 is #2. and #1 has #2. in your 1 and 2 respectively).

    – ShreevatsaR
    1 hour ago











  • @ShreevatsaR That's why I am asking how to extend this possibility.

    – Przemysław Scherwentke
    41 mins ago















3















In TeX I can define, say



def1#1 is #2.#1 & is & #2.\



and



def2#1 has #2.#1 & has & #2.\



with an easy usage:
1 Jim Jones is a fictional character.
and
2 Tim Smith has two brothers.



This gives three columns of a tabular: Jim Jones, is, a fictional character. Similarly in the second case.



Can I write a definition depending on, in this case, is/has so I can write



3 Jim Jones is a fictional character.
and
3 Tim Smith has two brothers.



obtaing the previous results?



Solutions using Lua or expl3 are OK, but I hope that a pure TeX one is also possible.










share|improve this question
























  • At the TeX level for any def you can have only one parameter text (the #1 is #2. and #1 has #2. in your 1 and 2 respectively).

    – ShreevatsaR
    1 hour ago











  • @ShreevatsaR That's why I am asking how to extend this possibility.

    – Przemysław Scherwentke
    41 mins ago













3












3








3








In TeX I can define, say



def1#1 is #2.#1 & is & #2.\



and



def2#1 has #2.#1 & has & #2.\



with an easy usage:
1 Jim Jones is a fictional character.
and
2 Tim Smith has two brothers.



This gives three columns of a tabular: Jim Jones, is, a fictional character. Similarly in the second case.



Can I write a definition depending on, in this case, is/has so I can write



3 Jim Jones is a fictional character.
and
3 Tim Smith has two brothers.



obtaing the previous results?



Solutions using Lua or expl3 are OK, but I hope that a pure TeX one is also possible.










share|improve this question
















In TeX I can define, say



def1#1 is #2.#1 & is & #2.\



and



def2#1 has #2.#1 & has & #2.\



with an easy usage:
1 Jim Jones is a fictional character.
and
2 Tim Smith has two brothers.



This gives three columns of a tabular: Jim Jones, is, a fictional character. Similarly in the second case.



Can I write a definition depending on, in this case, is/has so I can write



3 Jim Jones is a fictional character.
and
3 Tim Smith has two brothers.



obtaing the previous results?



Solutions using Lua or expl3 are OK, but I hope that a pure TeX one is also possible.







macros plain-tex






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 1 hour ago







Przemysław Scherwentke

















asked 1 hour ago









Przemysław ScherwentkePrzemysław Scherwentke

29.9k54795




29.9k54795












  • At the TeX level for any def you can have only one parameter text (the #1 is #2. and #1 has #2. in your 1 and 2 respectively).

    – ShreevatsaR
    1 hour ago











  • @ShreevatsaR That's why I am asking how to extend this possibility.

    – Przemysław Scherwentke
    41 mins ago

















  • At the TeX level for any def you can have only one parameter text (the #1 is #2. and #1 has #2. in your 1 and 2 respectively).

    – ShreevatsaR
    1 hour ago











  • @ShreevatsaR That's why I am asking how to extend this possibility.

    – Przemysław Scherwentke
    41 mins ago
















At the TeX level for any def you can have only one parameter text (the #1 is #2. and #1 has #2. in your 1 and 2 respectively).

– ShreevatsaR
1 hour ago





At the TeX level for any def you can have only one parameter text (the #1 is #2. and #1 has #2. in your 1 and 2 respectively).

– ShreevatsaR
1 hour ago













@ShreevatsaR That's why I am asking how to extend this possibility.

– Przemysław Scherwentke
41 mins ago





@ShreevatsaR That's why I am asking how to extend this possibility.

– Przemysław Scherwentke
41 mins ago










1 Answer
1






active

oldest

votes


















3














A listofitems approach. Also, listofitems is available in Plain TeX.



documentclassarticle
usepackagelistofitems
defvariant#1.%
setsepchar%
greadlist*varinput#1
varinput[1] & varinputsep[1] & varinput[2].

begindocument
begintabular
variant Jim Jones is a fictional character.\
variant Tim Smith has two brothers.
endtabular
enddocument


enter image description here



Similarly done in plain TeX



input listofitems
defvariant#1.%
setsepchar%
greadlist*varinput#1
varinput[1] & varinputsep[1] & varinput[2].

variant Jim Jones is a fictional character.

variant Tim Smith has two brothers.

bye





share|improve this answer























  • Certainly +1. However, I will wait for alternative solutions. And I must reserve 3 days for reading your package. :-)

    – Przemysław Scherwentke
    1 hour ago







  • 1





    @PrzemysławScherwentke Thanks. The package idea was mine, but the coding is all Christian's who made it come to life.

    – Steven B. Segletes
    1 hour ago






  • 1





    @marmot I am not sure what you mean by "teach" in this context. However, look also at my tabstackengine package, which uses listofitems for parsing. It can digest matrices and remember all the cell content for future use.

    – Steven B. Segletes
    47 mins ago






  • 1





    @marmot For example, documentclassarticle usepackage[T1]fontenc usepackagelistofitems setsepchar\/& begindocument readlist*myarrayx11&y12&z13\x21&y22&z_23\x31&y32&z33 Row 2, Col 3 = $myarray[2,3]$; tokens detokenizeexpandafterexpandafterexpandaftermyarray[2,3] enddocument

    – Steven B. Segletes
    36 mins ago






  • 1





    @PrzemysławScherwentke listofitems was developed in response to my ill-fated ctan.org/pkg/getargs getargs package. It was a great idea, but just didn't do what needed to be done. Christian T. took that idea and turned it into listofitems.

    – Steven B. Segletes
    28 mins ago











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%2f482357%2fhow-to-write-a-definition-with-variants%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














A listofitems approach. Also, listofitems is available in Plain TeX.



documentclassarticle
usepackagelistofitems
defvariant#1.%
setsepchar%
greadlist*varinput#1
varinput[1] & varinputsep[1] & varinput[2].

begindocument
begintabular
variant Jim Jones is a fictional character.\
variant Tim Smith has two brothers.
endtabular
enddocument


enter image description here



Similarly done in plain TeX



input listofitems
defvariant#1.%
setsepchar%
greadlist*varinput#1
varinput[1] & varinputsep[1] & varinput[2].

variant Jim Jones is a fictional character.

variant Tim Smith has two brothers.

bye





share|improve this answer























  • Certainly +1. However, I will wait for alternative solutions. And I must reserve 3 days for reading your package. :-)

    – Przemysław Scherwentke
    1 hour ago







  • 1





    @PrzemysławScherwentke Thanks. The package idea was mine, but the coding is all Christian's who made it come to life.

    – Steven B. Segletes
    1 hour ago






  • 1





    @marmot I am not sure what you mean by "teach" in this context. However, look also at my tabstackengine package, which uses listofitems for parsing. It can digest matrices and remember all the cell content for future use.

    – Steven B. Segletes
    47 mins ago






  • 1





    @marmot For example, documentclassarticle usepackage[T1]fontenc usepackagelistofitems setsepchar\/& begindocument readlist*myarrayx11&y12&z13\x21&y22&z_23\x31&y32&z33 Row 2, Col 3 = $myarray[2,3]$; tokens detokenizeexpandafterexpandafterexpandaftermyarray[2,3] enddocument

    – Steven B. Segletes
    36 mins ago






  • 1





    @PrzemysławScherwentke listofitems was developed in response to my ill-fated ctan.org/pkg/getargs getargs package. It was a great idea, but just didn't do what needed to be done. Christian T. took that idea and turned it into listofitems.

    – Steven B. Segletes
    28 mins ago















3














A listofitems approach. Also, listofitems is available in Plain TeX.



documentclassarticle
usepackagelistofitems
defvariant#1.%
setsepchar%
greadlist*varinput#1
varinput[1] & varinputsep[1] & varinput[2].

begindocument
begintabular
variant Jim Jones is a fictional character.\
variant Tim Smith has two brothers.
endtabular
enddocument


enter image description here



Similarly done in plain TeX



input listofitems
defvariant#1.%
setsepchar%
greadlist*varinput#1
varinput[1] & varinputsep[1] & varinput[2].

variant Jim Jones is a fictional character.

variant Tim Smith has two brothers.

bye





share|improve this answer























  • Certainly +1. However, I will wait for alternative solutions. And I must reserve 3 days for reading your package. :-)

    – Przemysław Scherwentke
    1 hour ago







  • 1





    @PrzemysławScherwentke Thanks. The package idea was mine, but the coding is all Christian's who made it come to life.

    – Steven B. Segletes
    1 hour ago






  • 1





    @marmot I am not sure what you mean by "teach" in this context. However, look also at my tabstackengine package, which uses listofitems for parsing. It can digest matrices and remember all the cell content for future use.

    – Steven B. Segletes
    47 mins ago






  • 1





    @marmot For example, documentclassarticle usepackage[T1]fontenc usepackagelistofitems setsepchar\/& begindocument readlist*myarrayx11&y12&z13\x21&y22&z_23\x31&y32&z33 Row 2, Col 3 = $myarray[2,3]$; tokens detokenizeexpandafterexpandafterexpandaftermyarray[2,3] enddocument

    – Steven B. Segletes
    36 mins ago






  • 1





    @PrzemysławScherwentke listofitems was developed in response to my ill-fated ctan.org/pkg/getargs getargs package. It was a great idea, but just didn't do what needed to be done. Christian T. took that idea and turned it into listofitems.

    – Steven B. Segletes
    28 mins ago













3












3








3







A listofitems approach. Also, listofitems is available in Plain TeX.



documentclassarticle
usepackagelistofitems
defvariant#1.%
setsepchar%
greadlist*varinput#1
varinput[1] & varinputsep[1] & varinput[2].

begindocument
begintabular
variant Jim Jones is a fictional character.\
variant Tim Smith has two brothers.
endtabular
enddocument


enter image description here



Similarly done in plain TeX



input listofitems
defvariant#1.%
setsepchar%
greadlist*varinput#1
varinput[1] & varinputsep[1] & varinput[2].

variant Jim Jones is a fictional character.

variant Tim Smith has two brothers.

bye





share|improve this answer













A listofitems approach. Also, listofitems is available in Plain TeX.



documentclassarticle
usepackagelistofitems
defvariant#1.%
setsepchar%
greadlist*varinput#1
varinput[1] & varinputsep[1] & varinput[2].

begindocument
begintabular
variant Jim Jones is a fictional character.\
variant Tim Smith has two brothers.
endtabular
enddocument


enter image description here



Similarly done in plain TeX



input listofitems
defvariant#1.%
setsepchar%
greadlist*varinput#1
varinput[1] & varinputsep[1] & varinput[2].

variant Jim Jones is a fictional character.

variant Tim Smith has two brothers.

bye






share|improve this answer












share|improve this answer



share|improve this answer










answered 1 hour ago









Steven B. SegletesSteven B. Segletes

160k9204413




160k9204413












  • Certainly +1. However, I will wait for alternative solutions. And I must reserve 3 days for reading your package. :-)

    – Przemysław Scherwentke
    1 hour ago







  • 1





    @PrzemysławScherwentke Thanks. The package idea was mine, but the coding is all Christian's who made it come to life.

    – Steven B. Segletes
    1 hour ago






  • 1





    @marmot I am not sure what you mean by "teach" in this context. However, look also at my tabstackengine package, which uses listofitems for parsing. It can digest matrices and remember all the cell content for future use.

    – Steven B. Segletes
    47 mins ago






  • 1





    @marmot For example, documentclassarticle usepackage[T1]fontenc usepackagelistofitems setsepchar\/& begindocument readlist*myarrayx11&y12&z13\x21&y22&z_23\x31&y32&z33 Row 2, Col 3 = $myarray[2,3]$; tokens detokenizeexpandafterexpandafterexpandaftermyarray[2,3] enddocument

    – Steven B. Segletes
    36 mins ago






  • 1





    @PrzemysławScherwentke listofitems was developed in response to my ill-fated ctan.org/pkg/getargs getargs package. It was a great idea, but just didn't do what needed to be done. Christian T. took that idea and turned it into listofitems.

    – Steven B. Segletes
    28 mins ago

















  • Certainly +1. However, I will wait for alternative solutions. And I must reserve 3 days for reading your package. :-)

    – Przemysław Scherwentke
    1 hour ago







  • 1





    @PrzemysławScherwentke Thanks. The package idea was mine, but the coding is all Christian's who made it come to life.

    – Steven B. Segletes
    1 hour ago






  • 1





    @marmot I am not sure what you mean by "teach" in this context. However, look also at my tabstackengine package, which uses listofitems for parsing. It can digest matrices and remember all the cell content for future use.

    – Steven B. Segletes
    47 mins ago






  • 1





    @marmot For example, documentclassarticle usepackage[T1]fontenc usepackagelistofitems setsepchar\/& begindocument readlist*myarrayx11&y12&z13\x21&y22&z_23\x31&y32&z33 Row 2, Col 3 = $myarray[2,3]$; tokens detokenizeexpandafterexpandafterexpandaftermyarray[2,3] enddocument

    – Steven B. Segletes
    36 mins ago






  • 1





    @PrzemysławScherwentke listofitems was developed in response to my ill-fated ctan.org/pkg/getargs getargs package. It was a great idea, but just didn't do what needed to be done. Christian T. took that idea and turned it into listofitems.

    – Steven B. Segletes
    28 mins ago
















Certainly +1. However, I will wait for alternative solutions. And I must reserve 3 days for reading your package. :-)

– Przemysław Scherwentke
1 hour ago






Certainly +1. However, I will wait for alternative solutions. And I must reserve 3 days for reading your package. :-)

– Przemysław Scherwentke
1 hour ago





1




1





@PrzemysławScherwentke Thanks. The package idea was mine, but the coding is all Christian's who made it come to life.

– Steven B. Segletes
1 hour ago





@PrzemysławScherwentke Thanks. The package idea was mine, but the coding is all Christian's who made it come to life.

– Steven B. Segletes
1 hour ago




1




1





@marmot I am not sure what you mean by "teach" in this context. However, look also at my tabstackengine package, which uses listofitems for parsing. It can digest matrices and remember all the cell content for future use.

– Steven B. Segletes
47 mins ago





@marmot I am not sure what you mean by "teach" in this context. However, look also at my tabstackengine package, which uses listofitems for parsing. It can digest matrices and remember all the cell content for future use.

– Steven B. Segletes
47 mins ago




1




1





@marmot For example, documentclassarticle usepackage[T1]fontenc usepackagelistofitems setsepchar\/& begindocument readlist*myarrayx11&y12&z13\x21&y22&z_23\x31&y32&z33 Row 2, Col 3 = $myarray[2,3]$; tokens detokenizeexpandafterexpandafterexpandaftermyarray[2,3] enddocument

– Steven B. Segletes
36 mins ago





@marmot For example, documentclassarticle usepackage[T1]fontenc usepackagelistofitems setsepchar\/& begindocument readlist*myarrayx11&y12&z13\x21&y22&z_23\x31&y32&z33 Row 2, Col 3 = $myarray[2,3]$; tokens detokenizeexpandafterexpandafterexpandaftermyarray[2,3] enddocument

– Steven B. Segletes
36 mins ago




1




1





@PrzemysławScherwentke listofitems was developed in response to my ill-fated ctan.org/pkg/getargs getargs package. It was a great idea, but just didn't do what needed to be done. Christian T. took that idea and turned it into listofitems.

– Steven B. Segletes
28 mins ago





@PrzemysławScherwentke listofitems was developed in response to my ill-fated ctan.org/pkg/getargs getargs package. It was a great idea, but just didn't do what needed to be done. Christian T. took that idea and turned it into listofitems.

– Steven B. Segletes
28 mins ago

















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%2f482357%2fhow-to-write-a-definition-with-variants%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

Magento 2 duplicate PHPSESSID cookie when using session_start() in custom php scriptMagento 2: User cant logged in into to account page, no error showing!Magento duplicate on subdomainGrabbing storeview from cookie (after using language selector)How do I run php custom script on magento2Magento 2: Include PHP script in headerSession lock after using Cm_RedisSessionscript php to update stockMagento set cookie popupMagento 2 session id cookie - where to find it?How to import Configurable product from csv with custom attributes using php scriptMagento 2 run custom PHP script

Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

How to solve knockout JS error in Magento 2 Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?(Magento2) knockout.js:3012 Uncaught ReferenceError: Unable to process bindingUnable to process binding Knockout.js magento 2Cannot read property `scopeLabel` of undefined on Product Detail PageCan't get Customer Data on frontend in Magento 2Magento2 Order Summary - unable to process bindingKO templates are not loading in Magento 2.1 applicationgetting knockout js error magento 2Product grid not load -— Unable to process binding Knockout.js magento 2Product form not loaded in magento2Uncaught ReferenceError: Unable to process binding “if: function()return (isShowLegend()) ” magento 2