Use comma instead of & in table

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












7















I am new in LaTeX. In tabular, we generally use & for partition. I want to create a .sty for tabular environment. Replace & with comma delimiter, in this case comma should be work as & like in tabular command.



In .tex file, input is a,b,c and output should look like |a|b|c|










share|improve this question



















  • 5





    I strongly recommend not to do that, because it is extremely complicated. Firstly you have to understand the definition of tabular in latex.ltx. That is a real problem.

    – JouleV
    Mar 4 at 14:53






  • 4





    I do not which use you would do of this convention, but how would you fiddle with cells that should contain commas? If it is for special types of tabulars, you might want to take a look at the csvsimple package, or the more powerful datatool.

    – Bernard
    Mar 4 at 15:00






  • 1





    @Bernard Can't you say the same about the default syntax: how would you fiddle with cells that should contain &s? Ultimately it depends on the nature of the data whether commas or ampersands are more common in the cells. (I'm not recommending trying to achieve the OP's goal in LaTeX -- my preference would be to run a preprocessor on the comma-separated data to produce valid LaTeX syntax -- just pointing out that the LaTeX syntax just happens to be what Knuth/Lamport decided to adopt for their use-cases, and isn't objectively better for all applications.)

    – ShreevatsaR
    Mar 4 at 18:16






  • 1





    @Bernard There is no intrinsic difference between & and ,` except that the former happens to have an appropriate definition in LaTeX by default, and the latter doesn't (and would have to be redefined after finding a new name for what is currently ,). And yes, commas may indeed be more common in many/most "typical" applications, but we don't know what's more common in the OP's application. Question is whether to bend the tool for the sake of our task or vice-versa… IMO the only reason for preferring & here is because LaTeX is more suited for it, not anything intrinsic to the syntax.

    – ShreevatsaR
    Mar 4 at 22:07






  • 1





    Hey, I also thought about that when I wanted to include my results.csv into the LaTeX report. However, I realised it was easier to export to CSV using & as a delimiter. For example, if using pandas, you can do dataframe.to_csv('results.csv', sep='&', line_terminator='\\n')

    – Ciprian Tomoiagă
    Mar 5 at 14:02
















7















I am new in LaTeX. In tabular, we generally use & for partition. I want to create a .sty for tabular environment. Replace & with comma delimiter, in this case comma should be work as & like in tabular command.



In .tex file, input is a,b,c and output should look like |a|b|c|










share|improve this question



















  • 5





    I strongly recommend not to do that, because it is extremely complicated. Firstly you have to understand the definition of tabular in latex.ltx. That is a real problem.

    – JouleV
    Mar 4 at 14:53






  • 4





    I do not which use you would do of this convention, but how would you fiddle with cells that should contain commas? If it is for special types of tabulars, you might want to take a look at the csvsimple package, or the more powerful datatool.

    – Bernard
    Mar 4 at 15:00






  • 1





    @Bernard Can't you say the same about the default syntax: how would you fiddle with cells that should contain &s? Ultimately it depends on the nature of the data whether commas or ampersands are more common in the cells. (I'm not recommending trying to achieve the OP's goal in LaTeX -- my preference would be to run a preprocessor on the comma-separated data to produce valid LaTeX syntax -- just pointing out that the LaTeX syntax just happens to be what Knuth/Lamport decided to adopt for their use-cases, and isn't objectively better for all applications.)

    – ShreevatsaR
    Mar 4 at 18:16






  • 1





    @Bernard There is no intrinsic difference between & and ,` except that the former happens to have an appropriate definition in LaTeX by default, and the latter doesn't (and would have to be redefined after finding a new name for what is currently ,). And yes, commas may indeed be more common in many/most "typical" applications, but we don't know what's more common in the OP's application. Question is whether to bend the tool for the sake of our task or vice-versa… IMO the only reason for preferring & here is because LaTeX is more suited for it, not anything intrinsic to the syntax.

    – ShreevatsaR
    Mar 4 at 22:07






  • 1





    Hey, I also thought about that when I wanted to include my results.csv into the LaTeX report. However, I realised it was easier to export to CSV using & as a delimiter. For example, if using pandas, you can do dataframe.to_csv('results.csv', sep='&', line_terminator='\\n')

    – Ciprian Tomoiagă
    Mar 5 at 14:02














7












7








7


0






I am new in LaTeX. In tabular, we generally use & for partition. I want to create a .sty for tabular environment. Replace & with comma delimiter, in this case comma should be work as & like in tabular command.



In .tex file, input is a,b,c and output should look like |a|b|c|










share|improve this question
















I am new in LaTeX. In tabular, we generally use & for partition. I want to create a .sty for tabular environment. Replace & with comma delimiter, in this case comma should be work as & like in tabular command.



In .tex file, input is a,b,c and output should look like |a|b|c|







tables tex-core






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 4 at 14:57









JouleV

9,66322357




9,66322357










asked Mar 4 at 14:48









limlianlimlian

361




361







  • 5





    I strongly recommend not to do that, because it is extremely complicated. Firstly you have to understand the definition of tabular in latex.ltx. That is a real problem.

    – JouleV
    Mar 4 at 14:53






  • 4





    I do not which use you would do of this convention, but how would you fiddle with cells that should contain commas? If it is for special types of tabulars, you might want to take a look at the csvsimple package, or the more powerful datatool.

    – Bernard
    Mar 4 at 15:00






  • 1





    @Bernard Can't you say the same about the default syntax: how would you fiddle with cells that should contain &s? Ultimately it depends on the nature of the data whether commas or ampersands are more common in the cells. (I'm not recommending trying to achieve the OP's goal in LaTeX -- my preference would be to run a preprocessor on the comma-separated data to produce valid LaTeX syntax -- just pointing out that the LaTeX syntax just happens to be what Knuth/Lamport decided to adopt for their use-cases, and isn't objectively better for all applications.)

    – ShreevatsaR
    Mar 4 at 18:16






  • 1





    @Bernard There is no intrinsic difference between & and ,` except that the former happens to have an appropriate definition in LaTeX by default, and the latter doesn't (and would have to be redefined after finding a new name for what is currently ,). And yes, commas may indeed be more common in many/most "typical" applications, but we don't know what's more common in the OP's application. Question is whether to bend the tool for the sake of our task or vice-versa… IMO the only reason for preferring & here is because LaTeX is more suited for it, not anything intrinsic to the syntax.

    – ShreevatsaR
    Mar 4 at 22:07






  • 1





    Hey, I also thought about that when I wanted to include my results.csv into the LaTeX report. However, I realised it was easier to export to CSV using & as a delimiter. For example, if using pandas, you can do dataframe.to_csv('results.csv', sep='&', line_terminator='\\n')

    – Ciprian Tomoiagă
    Mar 5 at 14:02













  • 5





    I strongly recommend not to do that, because it is extremely complicated. Firstly you have to understand the definition of tabular in latex.ltx. That is a real problem.

    – JouleV
    Mar 4 at 14:53






  • 4





    I do not which use you would do of this convention, but how would you fiddle with cells that should contain commas? If it is for special types of tabulars, you might want to take a look at the csvsimple package, or the more powerful datatool.

    – Bernard
    Mar 4 at 15:00






  • 1





    @Bernard Can't you say the same about the default syntax: how would you fiddle with cells that should contain &s? Ultimately it depends on the nature of the data whether commas or ampersands are more common in the cells. (I'm not recommending trying to achieve the OP's goal in LaTeX -- my preference would be to run a preprocessor on the comma-separated data to produce valid LaTeX syntax -- just pointing out that the LaTeX syntax just happens to be what Knuth/Lamport decided to adopt for their use-cases, and isn't objectively better for all applications.)

    – ShreevatsaR
    Mar 4 at 18:16






  • 1





    @Bernard There is no intrinsic difference between & and ,` except that the former happens to have an appropriate definition in LaTeX by default, and the latter doesn't (and would have to be redefined after finding a new name for what is currently ,). And yes, commas may indeed be more common in many/most "typical" applications, but we don't know what's more common in the OP's application. Question is whether to bend the tool for the sake of our task or vice-versa… IMO the only reason for preferring & here is because LaTeX is more suited for it, not anything intrinsic to the syntax.

    – ShreevatsaR
    Mar 4 at 22:07






  • 1





    Hey, I also thought about that when I wanted to include my results.csv into the LaTeX report. However, I realised it was easier to export to CSV using & as a delimiter. For example, if using pandas, you can do dataframe.to_csv('results.csv', sep='&', line_terminator='\\n')

    – Ciprian Tomoiagă
    Mar 5 at 14:02








5




5





I strongly recommend not to do that, because it is extremely complicated. Firstly you have to understand the definition of tabular in latex.ltx. That is a real problem.

– JouleV
Mar 4 at 14:53





I strongly recommend not to do that, because it is extremely complicated. Firstly you have to understand the definition of tabular in latex.ltx. That is a real problem.

– JouleV
Mar 4 at 14:53




4




4





I do not which use you would do of this convention, but how would you fiddle with cells that should contain commas? If it is for special types of tabulars, you might want to take a look at the csvsimple package, or the more powerful datatool.

– Bernard
Mar 4 at 15:00





I do not which use you would do of this convention, but how would you fiddle with cells that should contain commas? If it is for special types of tabulars, you might want to take a look at the csvsimple package, or the more powerful datatool.

– Bernard
Mar 4 at 15:00




1




1





@Bernard Can't you say the same about the default syntax: how would you fiddle with cells that should contain &s? Ultimately it depends on the nature of the data whether commas or ampersands are more common in the cells. (I'm not recommending trying to achieve the OP's goal in LaTeX -- my preference would be to run a preprocessor on the comma-separated data to produce valid LaTeX syntax -- just pointing out that the LaTeX syntax just happens to be what Knuth/Lamport decided to adopt for their use-cases, and isn't objectively better for all applications.)

– ShreevatsaR
Mar 4 at 18:16





@Bernard Can't you say the same about the default syntax: how would you fiddle with cells that should contain &s? Ultimately it depends on the nature of the data whether commas or ampersands are more common in the cells. (I'm not recommending trying to achieve the OP's goal in LaTeX -- my preference would be to run a preprocessor on the comma-separated data to produce valid LaTeX syntax -- just pointing out that the LaTeX syntax just happens to be what Knuth/Lamport decided to adopt for their use-cases, and isn't objectively better for all applications.)

– ShreevatsaR
Mar 4 at 18:16




1




1





@Bernard There is no intrinsic difference between & and ,` except that the former happens to have an appropriate definition in LaTeX by default, and the latter doesn't (and would have to be redefined after finding a new name for what is currently ,). And yes, commas may indeed be more common in many/most "typical" applications, but we don't know what's more common in the OP's application. Question is whether to bend the tool for the sake of our task or vice-versa… IMO the only reason for preferring & here is because LaTeX is more suited for it, not anything intrinsic to the syntax.

– ShreevatsaR
Mar 4 at 22:07





@Bernard There is no intrinsic difference between & and ,` except that the former happens to have an appropriate definition in LaTeX by default, and the latter doesn't (and would have to be redefined after finding a new name for what is currently ,). And yes, commas may indeed be more common in many/most "typical" applications, but we don't know what's more common in the OP's application. Question is whether to bend the tool for the sake of our task or vice-versa… IMO the only reason for preferring & here is because LaTeX is more suited for it, not anything intrinsic to the syntax.

– ShreevatsaR
Mar 4 at 22:07




1




1





Hey, I also thought about that when I wanted to include my results.csv into the LaTeX report. However, I realised it was easier to export to CSV using & as a delimiter. For example, if using pandas, you can do dataframe.to_csv('results.csv', sep='&', line_terminator='\\n')

– Ciprian Tomoiagă
Mar 5 at 14:02






Hey, I also thought about that when I wanted to include my results.csv into the LaTeX report. However, I realised it was easier to export to CSV using & as a delimiter. For example, if using pandas, you can do dataframe.to_csv('results.csv', sep='&', line_terminator='\\n')

– Ciprian Tomoiagă
Mar 5 at 14:02











3 Answers
3






active

oldest

votes


















12














Proof of concept. Use at your own risk!



The basic approach is to change catcode of the character you want to use as “alignment tab”. Here's a mytabular environment which does that:



documentclassarticle

usepackagexparse

ExplSyntaxOn
NewDocumentEnvironment mytabular O,

char_set_catcode_other:N &
char_set_catcode_alignment:n `#1
begintabular


endtabular

ExplSyntaxOff

begindocument
pagestyleempty

beginmytabularl
a , b & c \
c , d \
endmytabular

beginmytabular[@]l
a @ b \
c @ d, & e \
endmytabular

enddocument



enter image description here




The optional argument lets you choose which character is used as alignment tab. No verification whatsoever is done to see if the character you passed is valid. If you don't pass a character, a comma is used. The & behaves as a normal character.



However, as other already warned you, this is not the best idea. Packages that rely on & being an alignment tab will break.






share|improve this answer

























  • Thank you so much for your reply.

    – limlian
    Mar 5 at 7:18











  • @limlian TeX doesn't allow you more than 9 parameters. You'd have to find another way around to use 12. But in your example you used only 6 parameter (non consecutive). But I think that 12 is far from user friendly and I would suggest another approach, if you specified your use case. However, try the code I proposed with beginmytabularc a, b, c \ x, y, z \ endmytabular. It seem to do as you want.

    – Phelype Oleinik
    Mar 5 at 12:09











  • @limlian Please, add to your question, not to comments to an answer. But I believe that a new question, with better specification of your problem is what you should do.

    – egreg
    Mar 5 at 12:17


















10














As Bernard suggested, why don't use csvsimple?



If you have commas in your cells, just put the contents within curly brackets.



If you have & in your cells, just write &.



documentclassarticle
usepackagefilecontents
usepackagecsvsimple

begindocument

beginfilecontents*mydata.csv
a,b,c
endfilecontents*
csvreader[
tabular=|c|c|c|,
nohead
]mydata.csv% filename
csvcoli & csvcolii & csvcoliii

vspace3ex
and if you have commas or & in your cells:
vspace3ex

beginfilecontents*mydata.csv
a,b,c
c, d,e, f, g,h, i, j, k
l & m,n & o, p,q & r & s & t
endfilecontents*
csvreader[
tabular=|c|c|c|,
nohead
]mydata.csv% filename
csvcoli & csvcolii & csvcoliii

enddocument


enter image description here






share|improve this answer
































    8














    You can use the spalign package (documentation here), which includes spaligntabular that acts exactly like tabular, except it uses both space and comma as the align character & and semicolon as the the end-of-row control
    sequence \:



    documentclass[12pt]report
    usepackagespalign

    begindocument

    spaligntabularlcra b c; aa bb cc

    spaligntabularca,b,c

    enddocument


    It produces this:



    spaligntabular example



    and



    spaligntabular example 2



    The spalign package also includes similar commands, such as spalignmat for a matrix and spalignarray for a generic array.



    There are options to use different characters instead of or in addition to space, comma, and semicolon (see the documentation).



    By the way, if you need to include a comma, space, or semicolon in your table, just enclose it in braces .






    share|improve this answer




















    • 2





      I didn't know this package, I think it does exactly what the OP wants, +1!

      – CarLaTeX
      Mar 5 at 6:15











    • Absolutely I agree with @CarLaTeX :-) Very good.

      – Sebastiano
      Mar 5 at 12:57











    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%2f477714%2fuse-comma-instead-of-in-table%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









    12














    Proof of concept. Use at your own risk!



    The basic approach is to change catcode of the character you want to use as “alignment tab”. Here's a mytabular environment which does that:



    documentclassarticle

    usepackagexparse

    ExplSyntaxOn
    NewDocumentEnvironment mytabular O,

    char_set_catcode_other:N &
    char_set_catcode_alignment:n `#1
    begintabular


    endtabular

    ExplSyntaxOff

    begindocument
    pagestyleempty

    beginmytabularl
    a , b & c \
    c , d \
    endmytabular

    beginmytabular[@]l
    a @ b \
    c @ d, & e \
    endmytabular

    enddocument



    enter image description here




    The optional argument lets you choose which character is used as alignment tab. No verification whatsoever is done to see if the character you passed is valid. If you don't pass a character, a comma is used. The & behaves as a normal character.



    However, as other already warned you, this is not the best idea. Packages that rely on & being an alignment tab will break.






    share|improve this answer

























    • Thank you so much for your reply.

      – limlian
      Mar 5 at 7:18











    • @limlian TeX doesn't allow you more than 9 parameters. You'd have to find another way around to use 12. But in your example you used only 6 parameter (non consecutive). But I think that 12 is far from user friendly and I would suggest another approach, if you specified your use case. However, try the code I proposed with beginmytabularc a, b, c \ x, y, z \ endmytabular. It seem to do as you want.

      – Phelype Oleinik
      Mar 5 at 12:09











    • @limlian Please, add to your question, not to comments to an answer. But I believe that a new question, with better specification of your problem is what you should do.

      – egreg
      Mar 5 at 12:17















    12














    Proof of concept. Use at your own risk!



    The basic approach is to change catcode of the character you want to use as “alignment tab”. Here's a mytabular environment which does that:



    documentclassarticle

    usepackagexparse

    ExplSyntaxOn
    NewDocumentEnvironment mytabular O,

    char_set_catcode_other:N &
    char_set_catcode_alignment:n `#1
    begintabular


    endtabular

    ExplSyntaxOff

    begindocument
    pagestyleempty

    beginmytabularl
    a , b & c \
    c , d \
    endmytabular

    beginmytabular[@]l
    a @ b \
    c @ d, & e \
    endmytabular

    enddocument



    enter image description here




    The optional argument lets you choose which character is used as alignment tab. No verification whatsoever is done to see if the character you passed is valid. If you don't pass a character, a comma is used. The & behaves as a normal character.



    However, as other already warned you, this is not the best idea. Packages that rely on & being an alignment tab will break.






    share|improve this answer

























    • Thank you so much for your reply.

      – limlian
      Mar 5 at 7:18











    • @limlian TeX doesn't allow you more than 9 parameters. You'd have to find another way around to use 12. But in your example you used only 6 parameter (non consecutive). But I think that 12 is far from user friendly and I would suggest another approach, if you specified your use case. However, try the code I proposed with beginmytabularc a, b, c \ x, y, z \ endmytabular. It seem to do as you want.

      – Phelype Oleinik
      Mar 5 at 12:09











    • @limlian Please, add to your question, not to comments to an answer. But I believe that a new question, with better specification of your problem is what you should do.

      – egreg
      Mar 5 at 12:17













    12












    12








    12







    Proof of concept. Use at your own risk!



    The basic approach is to change catcode of the character you want to use as “alignment tab”. Here's a mytabular environment which does that:



    documentclassarticle

    usepackagexparse

    ExplSyntaxOn
    NewDocumentEnvironment mytabular O,

    char_set_catcode_other:N &
    char_set_catcode_alignment:n `#1
    begintabular


    endtabular

    ExplSyntaxOff

    begindocument
    pagestyleempty

    beginmytabularl
    a , b & c \
    c , d \
    endmytabular

    beginmytabular[@]l
    a @ b \
    c @ d, & e \
    endmytabular

    enddocument



    enter image description here




    The optional argument lets you choose which character is used as alignment tab. No verification whatsoever is done to see if the character you passed is valid. If you don't pass a character, a comma is used. The & behaves as a normal character.



    However, as other already warned you, this is not the best idea. Packages that rely on & being an alignment tab will break.






    share|improve this answer















    Proof of concept. Use at your own risk!



    The basic approach is to change catcode of the character you want to use as “alignment tab”. Here's a mytabular environment which does that:



    documentclassarticle

    usepackagexparse

    ExplSyntaxOn
    NewDocumentEnvironment mytabular O,

    char_set_catcode_other:N &
    char_set_catcode_alignment:n `#1
    begintabular


    endtabular

    ExplSyntaxOff

    begindocument
    pagestyleempty

    beginmytabularl
    a , b & c \
    c , d \
    endmytabular

    beginmytabular[@]l
    a @ b \
    c @ d, & e \
    endmytabular

    enddocument



    enter image description here




    The optional argument lets you choose which character is used as alignment tab. No verification whatsoever is done to see if the character you passed is valid. If you don't pass a character, a comma is used. The & behaves as a normal character.



    However, as other already warned you, this is not the best idea. Packages that rely on & being an alignment tab will break.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Mar 5 at 12:10

























    answered Mar 4 at 15:11









    Phelype OleinikPhelype Oleinik

    24.6k54688




    24.6k54688












    • Thank you so much for your reply.

      – limlian
      Mar 5 at 7:18











    • @limlian TeX doesn't allow you more than 9 parameters. You'd have to find another way around to use 12. But in your example you used only 6 parameter (non consecutive). But I think that 12 is far from user friendly and I would suggest another approach, if you specified your use case. However, try the code I proposed with beginmytabularc a, b, c \ x, y, z \ endmytabular. It seem to do as you want.

      – Phelype Oleinik
      Mar 5 at 12:09











    • @limlian Please, add to your question, not to comments to an answer. But I believe that a new question, with better specification of your problem is what you should do.

      – egreg
      Mar 5 at 12:17

















    • Thank you so much for your reply.

      – limlian
      Mar 5 at 7:18











    • @limlian TeX doesn't allow you more than 9 parameters. You'd have to find another way around to use 12. But in your example you used only 6 parameter (non consecutive). But I think that 12 is far from user friendly and I would suggest another approach, if you specified your use case. However, try the code I proposed with beginmytabularc a, b, c \ x, y, z \ endmytabular. It seem to do as you want.

      – Phelype Oleinik
      Mar 5 at 12:09











    • @limlian Please, add to your question, not to comments to an answer. But I believe that a new question, with better specification of your problem is what you should do.

      – egreg
      Mar 5 at 12:17
















    Thank you so much for your reply.

    – limlian
    Mar 5 at 7:18





    Thank you so much for your reply.

    – limlian
    Mar 5 at 7:18













    @limlian TeX doesn't allow you more than 9 parameters. You'd have to find another way around to use 12. But in your example you used only 6 parameter (non consecutive). But I think that 12 is far from user friendly and I would suggest another approach, if you specified your use case. However, try the code I proposed with beginmytabularc a, b, c \ x, y, z \ endmytabular. It seem to do as you want.

    – Phelype Oleinik
    Mar 5 at 12:09





    @limlian TeX doesn't allow you more than 9 parameters. You'd have to find another way around to use 12. But in your example you used only 6 parameter (non consecutive). But I think that 12 is far from user friendly and I would suggest another approach, if you specified your use case. However, try the code I proposed with beginmytabularc a, b, c \ x, y, z \ endmytabular. It seem to do as you want.

    – Phelype Oleinik
    Mar 5 at 12:09













    @limlian Please, add to your question, not to comments to an answer. But I believe that a new question, with better specification of your problem is what you should do.

    – egreg
    Mar 5 at 12:17





    @limlian Please, add to your question, not to comments to an answer. But I believe that a new question, with better specification of your problem is what you should do.

    – egreg
    Mar 5 at 12:17











    10














    As Bernard suggested, why don't use csvsimple?



    If you have commas in your cells, just put the contents within curly brackets.



    If you have & in your cells, just write &.



    documentclassarticle
    usepackagefilecontents
    usepackagecsvsimple

    begindocument

    beginfilecontents*mydata.csv
    a,b,c
    endfilecontents*
    csvreader[
    tabular=|c|c|c|,
    nohead
    ]mydata.csv% filename
    csvcoli & csvcolii & csvcoliii

    vspace3ex
    and if you have commas or & in your cells:
    vspace3ex

    beginfilecontents*mydata.csv
    a,b,c
    c, d,e, f, g,h, i, j, k
    l & m,n & o, p,q & r & s & t
    endfilecontents*
    csvreader[
    tabular=|c|c|c|,
    nohead
    ]mydata.csv% filename
    csvcoli & csvcolii & csvcoliii

    enddocument


    enter image description here






    share|improve this answer





























      10














      As Bernard suggested, why don't use csvsimple?



      If you have commas in your cells, just put the contents within curly brackets.



      If you have & in your cells, just write &.



      documentclassarticle
      usepackagefilecontents
      usepackagecsvsimple

      begindocument

      beginfilecontents*mydata.csv
      a,b,c
      endfilecontents*
      csvreader[
      tabular=|c|c|c|,
      nohead
      ]mydata.csv% filename
      csvcoli & csvcolii & csvcoliii

      vspace3ex
      and if you have commas or & in your cells:
      vspace3ex

      beginfilecontents*mydata.csv
      a,b,c
      c, d,e, f, g,h, i, j, k
      l & m,n & o, p,q & r & s & t
      endfilecontents*
      csvreader[
      tabular=|c|c|c|,
      nohead
      ]mydata.csv% filename
      csvcoli & csvcolii & csvcoliii

      enddocument


      enter image description here






      share|improve this answer



























        10












        10








        10







        As Bernard suggested, why don't use csvsimple?



        If you have commas in your cells, just put the contents within curly brackets.



        If you have & in your cells, just write &.



        documentclassarticle
        usepackagefilecontents
        usepackagecsvsimple

        begindocument

        beginfilecontents*mydata.csv
        a,b,c
        endfilecontents*
        csvreader[
        tabular=|c|c|c|,
        nohead
        ]mydata.csv% filename
        csvcoli & csvcolii & csvcoliii

        vspace3ex
        and if you have commas or & in your cells:
        vspace3ex

        beginfilecontents*mydata.csv
        a,b,c
        c, d,e, f, g,h, i, j, k
        l & m,n & o, p,q & r & s & t
        endfilecontents*
        csvreader[
        tabular=|c|c|c|,
        nohead
        ]mydata.csv% filename
        csvcoli & csvcolii & csvcoliii

        enddocument


        enter image description here






        share|improve this answer















        As Bernard suggested, why don't use csvsimple?



        If you have commas in your cells, just put the contents within curly brackets.



        If you have & in your cells, just write &.



        documentclassarticle
        usepackagefilecontents
        usepackagecsvsimple

        begindocument

        beginfilecontents*mydata.csv
        a,b,c
        endfilecontents*
        csvreader[
        tabular=|c|c|c|,
        nohead
        ]mydata.csv% filename
        csvcoli & csvcolii & csvcoliii

        vspace3ex
        and if you have commas or & in your cells:
        vspace3ex

        beginfilecontents*mydata.csv
        a,b,c
        c, d,e, f, g,h, i, j, k
        l & m,n & o, p,q & r & s & t
        endfilecontents*
        csvreader[
        tabular=|c|c|c|,
        nohead
        ]mydata.csv% filename
        csvcoli & csvcolii & csvcoliii

        enddocument


        enter image description here







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 5 at 6:10

























        answered Mar 4 at 19:54









        CarLaTeXCarLaTeX

        34.3k552141




        34.3k552141





















            8














            You can use the spalign package (documentation here), which includes spaligntabular that acts exactly like tabular, except it uses both space and comma as the align character & and semicolon as the the end-of-row control
            sequence \:



            documentclass[12pt]report
            usepackagespalign

            begindocument

            spaligntabularlcra b c; aa bb cc

            spaligntabularca,b,c

            enddocument


            It produces this:



            spaligntabular example



            and



            spaligntabular example 2



            The spalign package also includes similar commands, such as spalignmat for a matrix and spalignarray for a generic array.



            There are options to use different characters instead of or in addition to space, comma, and semicolon (see the documentation).



            By the way, if you need to include a comma, space, or semicolon in your table, just enclose it in braces .






            share|improve this answer




















            • 2





              I didn't know this package, I think it does exactly what the OP wants, +1!

              – CarLaTeX
              Mar 5 at 6:15











            • Absolutely I agree with @CarLaTeX :-) Very good.

              – Sebastiano
              Mar 5 at 12:57















            8














            You can use the spalign package (documentation here), which includes spaligntabular that acts exactly like tabular, except it uses both space and comma as the align character & and semicolon as the the end-of-row control
            sequence \:



            documentclass[12pt]report
            usepackagespalign

            begindocument

            spaligntabularlcra b c; aa bb cc

            spaligntabularca,b,c

            enddocument


            It produces this:



            spaligntabular example



            and



            spaligntabular example 2



            The spalign package also includes similar commands, such as spalignmat for a matrix and spalignarray for a generic array.



            There are options to use different characters instead of or in addition to space, comma, and semicolon (see the documentation).



            By the way, if you need to include a comma, space, or semicolon in your table, just enclose it in braces .






            share|improve this answer




















            • 2





              I didn't know this package, I think it does exactly what the OP wants, +1!

              – CarLaTeX
              Mar 5 at 6:15











            • Absolutely I agree with @CarLaTeX :-) Very good.

              – Sebastiano
              Mar 5 at 12:57













            8












            8








            8







            You can use the spalign package (documentation here), which includes spaligntabular that acts exactly like tabular, except it uses both space and comma as the align character & and semicolon as the the end-of-row control
            sequence \:



            documentclass[12pt]report
            usepackagespalign

            begindocument

            spaligntabularlcra b c; aa bb cc

            spaligntabularca,b,c

            enddocument


            It produces this:



            spaligntabular example



            and



            spaligntabular example 2



            The spalign package also includes similar commands, such as spalignmat for a matrix and spalignarray for a generic array.



            There are options to use different characters instead of or in addition to space, comma, and semicolon (see the documentation).



            By the way, if you need to include a comma, space, or semicolon in your table, just enclose it in braces .






            share|improve this answer















            You can use the spalign package (documentation here), which includes spaligntabular that acts exactly like tabular, except it uses both space and comma as the align character & and semicolon as the the end-of-row control
            sequence \:



            documentclass[12pt]report
            usepackagespalign

            begindocument

            spaligntabularlcra b c; aa bb cc

            spaligntabularca,b,c

            enddocument


            It produces this:



            spaligntabular example



            and



            spaligntabular example 2



            The spalign package also includes similar commands, such as spalignmat for a matrix and spalignarray for a generic array.



            There are options to use different characters instead of or in addition to space, comma, and semicolon (see the documentation).



            By the way, if you need to include a comma, space, or semicolon in your table, just enclose it in braces .







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 5 at 3:12

























            answered Mar 5 at 3:05









            JasonVJasonV

            1036




            1036







            • 2





              I didn't know this package, I think it does exactly what the OP wants, +1!

              – CarLaTeX
              Mar 5 at 6:15











            • Absolutely I agree with @CarLaTeX :-) Very good.

              – Sebastiano
              Mar 5 at 12:57












            • 2





              I didn't know this package, I think it does exactly what the OP wants, +1!

              – CarLaTeX
              Mar 5 at 6:15











            • Absolutely I agree with @CarLaTeX :-) Very good.

              – Sebastiano
              Mar 5 at 12:57







            2




            2





            I didn't know this package, I think it does exactly what the OP wants, +1!

            – CarLaTeX
            Mar 5 at 6:15





            I didn't know this package, I think it does exactly what the OP wants, +1!

            – CarLaTeX
            Mar 5 at 6:15













            Absolutely I agree with @CarLaTeX :-) Very good.

            – Sebastiano
            Mar 5 at 12:57





            Absolutely I agree with @CarLaTeX :-) Very good.

            – Sebastiano
            Mar 5 at 12:57

















            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%2f477714%2fuse-comma-instead-of-in-table%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

            How to check contact read email or not when send email to Individual?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?