Why is LaTeX missing $ when I have no mathematical equation and how do I center the table?

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











up vote
9
down vote

favorite












I am new to LaTeX. However, I don't know why this code is not working:



documentclassarticle
usepackage[utf8]inputenc

usepackage[english]babel

usepackage[usenames, dvipsnames]color
usepackagemultirow

titler
authoromar113057
dateSeptember 2018

begindocument

maketitle

sectionIntroduction

definecolorblackrgb0.0, 0.0, 0.0
begintable[!hbtp]
begincenter
beginnormalsize
colorblack
begintabularllcrr
hline
&Female&Male&\
&(N=287)&(N=570)&multirow-2*p\
hline
age & 68.7 pm 10.7 & 60.6 pm 11.2 & < 0.001\
hline
cardiogenicShock &&& 0.136\
hspace0.5cm No &275 (95.8%)&530 (93.0%)&\
hspace0.5cm Yes &12 ( 4.2%)&40 ( 7.0%)&\
hline
entry &&&0.035\
hspace0.5cm Femoral &119 (41.5%)&193 (33.9%)&\
hspace0.5cm Radial &168 (58.5%)&377 (66.1%)&\
hline
Dx &&&0.012\
hspace0.5cm NSTEMI &50 (17.4%)&103 (18.1%)&\
hspace0.5cm STEMI &84 (29.3%)&220 (38.6%)&\
hspace0.5cm Unstable Angina&153 (53.3%)&247 (43.3%)&\
hline
EF &56.3 pm 10.1&55.6 pm 9.4&0.387\
hline
height &153.8 pm 6.2&167.9 pm 6.1&< 0.001\
hline
weight &57.2 pm 9.3&68.7 pm 10.3&< 0.001\
hline
BMI &24.2 pm 3.6&24.3 pm 3.2&0.611\
hline
obesity &&&0.580\
hline
hspace0.5cm No &194 (67.6%)&373 (65.4%)&\
hline
hspace0.5cm Yes &93 (32.4%)&197 (34.6%)&\
TC &188.9 pm 51.1&183.3 pm 45.9&0.124\
hline
LDLC &117.8 pm 41.2&116.0 pm 41.1&0.561\
hline
HDLC &39.0 pm 11.5&37.8 pm 10.9&0.145\
hline
TG &119.9 pm 76.2&127.9 pm 97.3&0.195\
hline
DM &&&0.077\
hspace0.5cm No &173 (60.3%)&380 (66.7%)&\
hspace0.5cm Yes &114 (39.7%)&190 (33.3%)&\
HBP &&&< 0.001\
hspace0.5cm No &83 (28.9%)&273 (47.9%)&\
hspace0.5cm Yes &204 (71.1%)&297 (52.1%)&\
hline
smoking &&&< 0.001\
hspace0.5cm Ex-smoker &49 (17.1%)&155 (27.2%)&\
hspace0.5cm Never &209 (72.8%)&123 (21.6%)&\
hspace0.5cm Smoker &29 (10.1%)&292 (51.2%)&\
hline
endtabular
endnormalsize
endcenter
endtable
colorblack
enddocument


This code is generated from an R package called ztable. I fixed a lot of errors in this code however, and this $ sign that the log keeps throwing is very strange to me as I don't see any pattern here.



Also I want to make a pretty centered and well spaced table. How can I achieve that?










share|improve this question









New contributor




Omar113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 8




    Hi, welcome. As a first step, note that pm works only in math mode.
    – Torbjørn T.
    12 hours ago










  • I actually have replaced +- symbol that was generated by ztable package as it was not rendered at any point. @TorbjørnT.
    – Omar113
    11 hours ago














up vote
9
down vote

favorite












I am new to LaTeX. However, I don't know why this code is not working:



documentclassarticle
usepackage[utf8]inputenc

usepackage[english]babel

usepackage[usenames, dvipsnames]color
usepackagemultirow

titler
authoromar113057
dateSeptember 2018

begindocument

maketitle

sectionIntroduction

definecolorblackrgb0.0, 0.0, 0.0
begintable[!hbtp]
begincenter
beginnormalsize
colorblack
begintabularllcrr
hline
&Female&Male&\
&(N=287)&(N=570)&multirow-2*p\
hline
age & 68.7 pm 10.7 & 60.6 pm 11.2 & < 0.001\
hline
cardiogenicShock &&& 0.136\
hspace0.5cm No &275 (95.8%)&530 (93.0%)&\
hspace0.5cm Yes &12 ( 4.2%)&40 ( 7.0%)&\
hline
entry &&&0.035\
hspace0.5cm Femoral &119 (41.5%)&193 (33.9%)&\
hspace0.5cm Radial &168 (58.5%)&377 (66.1%)&\
hline
Dx &&&0.012\
hspace0.5cm NSTEMI &50 (17.4%)&103 (18.1%)&\
hspace0.5cm STEMI &84 (29.3%)&220 (38.6%)&\
hspace0.5cm Unstable Angina&153 (53.3%)&247 (43.3%)&\
hline
EF &56.3 pm 10.1&55.6 pm 9.4&0.387\
hline
height &153.8 pm 6.2&167.9 pm 6.1&< 0.001\
hline
weight &57.2 pm 9.3&68.7 pm 10.3&< 0.001\
hline
BMI &24.2 pm 3.6&24.3 pm 3.2&0.611\
hline
obesity &&&0.580\
hline
hspace0.5cm No &194 (67.6%)&373 (65.4%)&\
hline
hspace0.5cm Yes &93 (32.4%)&197 (34.6%)&\
TC &188.9 pm 51.1&183.3 pm 45.9&0.124\
hline
LDLC &117.8 pm 41.2&116.0 pm 41.1&0.561\
hline
HDLC &39.0 pm 11.5&37.8 pm 10.9&0.145\
hline
TG &119.9 pm 76.2&127.9 pm 97.3&0.195\
hline
DM &&&0.077\
hspace0.5cm No &173 (60.3%)&380 (66.7%)&\
hspace0.5cm Yes &114 (39.7%)&190 (33.3%)&\
HBP &&&< 0.001\
hspace0.5cm No &83 (28.9%)&273 (47.9%)&\
hspace0.5cm Yes &204 (71.1%)&297 (52.1%)&\
hline
smoking &&&< 0.001\
hspace0.5cm Ex-smoker &49 (17.1%)&155 (27.2%)&\
hspace0.5cm Never &209 (72.8%)&123 (21.6%)&\
hspace0.5cm Smoker &29 (10.1%)&292 (51.2%)&\
hline
endtabular
endnormalsize
endcenter
endtable
colorblack
enddocument


This code is generated from an R package called ztable. I fixed a lot of errors in this code however, and this $ sign that the log keeps throwing is very strange to me as I don't see any pattern here.



Also I want to make a pretty centered and well spaced table. How can I achieve that?










share|improve this question









New contributor




Omar113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 8




    Hi, welcome. As a first step, note that pm works only in math mode.
    – Torbjørn T.
    12 hours ago










  • I actually have replaced +- symbol that was generated by ztable package as it was not rendered at any point. @TorbjørnT.
    – Omar113
    11 hours ago












up vote
9
down vote

favorite









up vote
9
down vote

favorite











I am new to LaTeX. However, I don't know why this code is not working:



documentclassarticle
usepackage[utf8]inputenc

usepackage[english]babel

usepackage[usenames, dvipsnames]color
usepackagemultirow

titler
authoromar113057
dateSeptember 2018

begindocument

maketitle

sectionIntroduction

definecolorblackrgb0.0, 0.0, 0.0
begintable[!hbtp]
begincenter
beginnormalsize
colorblack
begintabularllcrr
hline
&Female&Male&\
&(N=287)&(N=570)&multirow-2*p\
hline
age & 68.7 pm 10.7 & 60.6 pm 11.2 & < 0.001\
hline
cardiogenicShock &&& 0.136\
hspace0.5cm No &275 (95.8%)&530 (93.0%)&\
hspace0.5cm Yes &12 ( 4.2%)&40 ( 7.0%)&\
hline
entry &&&0.035\
hspace0.5cm Femoral &119 (41.5%)&193 (33.9%)&\
hspace0.5cm Radial &168 (58.5%)&377 (66.1%)&\
hline
Dx &&&0.012\
hspace0.5cm NSTEMI &50 (17.4%)&103 (18.1%)&\
hspace0.5cm STEMI &84 (29.3%)&220 (38.6%)&\
hspace0.5cm Unstable Angina&153 (53.3%)&247 (43.3%)&\
hline
EF &56.3 pm 10.1&55.6 pm 9.4&0.387\
hline
height &153.8 pm 6.2&167.9 pm 6.1&< 0.001\
hline
weight &57.2 pm 9.3&68.7 pm 10.3&< 0.001\
hline
BMI &24.2 pm 3.6&24.3 pm 3.2&0.611\
hline
obesity &&&0.580\
hline
hspace0.5cm No &194 (67.6%)&373 (65.4%)&\
hline
hspace0.5cm Yes &93 (32.4%)&197 (34.6%)&\
TC &188.9 pm 51.1&183.3 pm 45.9&0.124\
hline
LDLC &117.8 pm 41.2&116.0 pm 41.1&0.561\
hline
HDLC &39.0 pm 11.5&37.8 pm 10.9&0.145\
hline
TG &119.9 pm 76.2&127.9 pm 97.3&0.195\
hline
DM &&&0.077\
hspace0.5cm No &173 (60.3%)&380 (66.7%)&\
hspace0.5cm Yes &114 (39.7%)&190 (33.3%)&\
HBP &&&< 0.001\
hspace0.5cm No &83 (28.9%)&273 (47.9%)&\
hspace0.5cm Yes &204 (71.1%)&297 (52.1%)&\
hline
smoking &&&< 0.001\
hspace0.5cm Ex-smoker &49 (17.1%)&155 (27.2%)&\
hspace0.5cm Never &209 (72.8%)&123 (21.6%)&\
hspace0.5cm Smoker &29 (10.1%)&292 (51.2%)&\
hline
endtabular
endnormalsize
endcenter
endtable
colorblack
enddocument


This code is generated from an R package called ztable. I fixed a lot of errors in this code however, and this $ sign that the log keeps throwing is very strange to me as I don't see any pattern here.



Also I want to make a pretty centered and well spaced table. How can I achieve that?










share|improve this question









New contributor




Omar113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I am new to LaTeX. However, I don't know why this code is not working:



documentclassarticle
usepackage[utf8]inputenc

usepackage[english]babel

usepackage[usenames, dvipsnames]color
usepackagemultirow

titler
authoromar113057
dateSeptember 2018

begindocument

maketitle

sectionIntroduction

definecolorblackrgb0.0, 0.0, 0.0
begintable[!hbtp]
begincenter
beginnormalsize
colorblack
begintabularllcrr
hline
&Female&Male&\
&(N=287)&(N=570)&multirow-2*p\
hline
age & 68.7 pm 10.7 & 60.6 pm 11.2 & < 0.001\
hline
cardiogenicShock &&& 0.136\
hspace0.5cm No &275 (95.8%)&530 (93.0%)&\
hspace0.5cm Yes &12 ( 4.2%)&40 ( 7.0%)&\
hline
entry &&&0.035\
hspace0.5cm Femoral &119 (41.5%)&193 (33.9%)&\
hspace0.5cm Radial &168 (58.5%)&377 (66.1%)&\
hline
Dx &&&0.012\
hspace0.5cm NSTEMI &50 (17.4%)&103 (18.1%)&\
hspace0.5cm STEMI &84 (29.3%)&220 (38.6%)&\
hspace0.5cm Unstable Angina&153 (53.3%)&247 (43.3%)&\
hline
EF &56.3 pm 10.1&55.6 pm 9.4&0.387\
hline
height &153.8 pm 6.2&167.9 pm 6.1&< 0.001\
hline
weight &57.2 pm 9.3&68.7 pm 10.3&< 0.001\
hline
BMI &24.2 pm 3.6&24.3 pm 3.2&0.611\
hline
obesity &&&0.580\
hline
hspace0.5cm No &194 (67.6%)&373 (65.4%)&\
hline
hspace0.5cm Yes &93 (32.4%)&197 (34.6%)&\
TC &188.9 pm 51.1&183.3 pm 45.9&0.124\
hline
LDLC &117.8 pm 41.2&116.0 pm 41.1&0.561\
hline
HDLC &39.0 pm 11.5&37.8 pm 10.9&0.145\
hline
TG &119.9 pm 76.2&127.9 pm 97.3&0.195\
hline
DM &&&0.077\
hspace0.5cm No &173 (60.3%)&380 (66.7%)&\
hspace0.5cm Yes &114 (39.7%)&190 (33.3%)&\
HBP &&&< 0.001\
hspace0.5cm No &83 (28.9%)&273 (47.9%)&\
hspace0.5cm Yes &204 (71.1%)&297 (52.1%)&\
hline
smoking &&&< 0.001\
hspace0.5cm Ex-smoker &49 (17.1%)&155 (27.2%)&\
hspace0.5cm Never &209 (72.8%)&123 (21.6%)&\
hspace0.5cm Smoker &29 (10.1%)&292 (51.2%)&\
hline
endtabular
endnormalsize
endcenter
endtable
colorblack
enddocument


This code is generated from an R package called ztable. I fixed a lot of errors in this code however, and this $ sign that the log keeps throwing is very strange to me as I don't see any pattern here.



Also I want to make a pretty centered and well spaced table. How can I achieve that?







tables






share|improve this question









New contributor




Omar113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Omar113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 15 mins ago









Peter Mortensen

49936




49936






New contributor




Omar113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 12 hours ago









Omar113

482




482




New contributor




Omar113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Omar113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Omar113 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 8




    Hi, welcome. As a first step, note that pm works only in math mode.
    – Torbjørn T.
    12 hours ago










  • I actually have replaced +- symbol that was generated by ztable package as it was not rendered at any point. @TorbjørnT.
    – Omar113
    11 hours ago












  • 8




    Hi, welcome. As a first step, note that pm works only in math mode.
    – Torbjørn T.
    12 hours ago










  • I actually have replaced +- symbol that was generated by ztable package as it was not rendered at any point. @TorbjørnT.
    – Omar113
    11 hours ago







8




8




Hi, welcome. As a first step, note that pm works only in math mode.
– Torbjørn T.
12 hours ago




Hi, welcome. As a first step, note that pm works only in math mode.
– Torbjørn T.
12 hours ago












I actually have replaced +- symbol that was generated by ztable package as it was not rendered at any point. @TorbjørnT.
– Omar113
11 hours ago




I actually have replaced +- symbol that was generated by ztable package as it was not rendered at any point. @TorbjørnT.
– Omar113
11 hours ago










2 Answers
2






active

oldest

votes

















up vote
16
down vote



accepted










The main issue is that the pm macro must occur in math mode. To minimize the number of $ symbols needed to enter and exit math mode, I suggest you employ versions of the l, r, and c column types which are in math mode automatically. See the code below for a way to do just that.



In addition, I would restructure the table to provided separate columns for the counts and percentages.



And, don't use begincenter and endcenter in a table environment. Instead, use a single centering instruction.



Finally, I would omit most horizontal lines or, at the very least, replace them with a bit of vertical whitespace. And, do load the booktabs package and use toprule, midrule, and bottomrule for the three remaining horizontal lines.



enter image description here



documentclassarticle
usepackage[utf8]inputenc
usepackage[english]babel

usepackagemultirow
usepackagearray,booktabs % <-- new

% automatic math-mode column types:
newcolumntypeL>$l<$ % left-aligned
newcolumntypeC>$c<$ % centered
newcolumntypeR>$r<$ % right-aligned

% two handy shortcut macros:
newcommandmcC[1]multicolumn2C#1
newcommandmcR[1]multicolumn2R#1

begindocument

begintable[!ptbh]
captionAn informative table
smallskip

centering
begintabular@l *2R @hspace1mm R R @
toprule
&mcC$Female$ & mcC$Male$ & \
&mcC(N=287) & mcC(N=570) & multirow-2*$p$\
midrule
Age & mcR68.7 pm 10.7 & mcR60.6 pm 11.2 & <0.001\
addlinespace
CardiogenicShock &&&&& 0.136\
hspace5mm No &275 & (95.8%) &530 & (93.0%) &\
hspace5mm Yes & 12 & ( 4.2%) & 40 & (7.0%) &\
addlinespace
Entry &&&&&0.035\
hspace5mm Femoral &119 & (41.5%) &193 & (33.9%) &\
hspace5mm Radial &168 & (58.5%) &377 & (66.1%) &\
addlinespace
DX &&&&&0.012\
hspace5mm NSTEMI &50 & (17.4%) &103 & (18.1%) &\
hspace5mm STEMI &84 & (29.3%) &220 & (38.6%) &\
hspace5mm Unstable Angina&153 & (53.3%) &247 & (43.3%) &\
addlinespace
EF & mcR56.3 pm 10.1 & mcR55.6 pm 9.4 &0.387\
addlinespace
Height & mcR153.8pm 6.2 & mcR167.9pm 6.1&< 0.001\
addlinespace
Weight & mcR57.2 pm 9.3 & mcR68.7 pm 10.3 &< 0.001\
addlinespace
BMI & mcR24.2 pm 3.6 & mcR24.3 pm 3.2 &0.611\
addlinespace
Obesity &&&&&0.580\
hspace5mm No &194 & (67.6%) &373 & (65.4%) &\
hspace5mm Yes & 93 & (32.4%) &197 & (34.6%) &\
addlinespace
TC & mcR188.9pm 51.1 & mcR183.3pm 45.9 &0.124\
addlinespace
LDLC & mcR117.8pm 41.2 & mcR116.0pm 41.1 &0.561\
addlinespace
HDLC & mcR39.0 pm 11.5 & mcR37.8 pm 10.9 &0.145\
addlinespace
TG & mcR119.9pm 76.2 & mcR127.9pm 97.3 &0.195\
addlinespace
DM &&&&&0.077\
hspace5mm No &173 & (60.3%) &380 & (66.7%) &\
hspace5mm Yes &114 & (39.7%) &190 & (33.3%) &\
addlinespace
HBP &&&&&< 0.001\
hspace5mm No & 83 & (28.9%) &273 & (47.9%) &\
hspace5mm Yes &204 & (71.1%) &297 & (52.1%) &\
addlinespace
Smoking &&&&&< 0.001\
hspace5mm Ex-smoker & 49 & (17.1%) &155 & (27.2%) &\
hspace5mm Never &209 & (72.8%) &123 & (21.6%) &\
hspace5mm Smoker & 29 & (10.1%) &292 & (51.2%) &\
bottomrule
endtabular
endtable
enddocument





share|improve this answer


















  • 1




    thank you. one last enquiry. i got this symbol (±) initially before I replaced it with pm. I was not rendered and showed error. Do you know how to render it without adding pm? @DavidCarlisle
    – Omar113
    11 hours ago







  • 3




    @Omar113 - I take it that you're using pdfLaTeX. To typeset the Unicode symbol ± directly, i.e., without first changing it over to pm, you need to use a unicode-aware typesetting engine (such as XeLaTeX and LuaLaTeX) as well as a font that includes this symbol.
    – Mico
    11 hours ago


















up vote
13
down vote













pm is a math command so the first error you get is about that and recovers by adding $ so your input is equivalent to $pm then you get a second error at the end of the cell that a second $ to close math mode is missing. use $68.7 pm 10.7$ and similarly use math for all the numeric entries whether or not they have pm so they are all set in the same font.






share|improve this answer




















    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',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    Omar113 is a new contributor. Be nice, and check out our Code of Conduct.









     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f453165%2fwhy-is-latex-missing-when-i-have-no-mathematical-equation-and-how-do-i-center%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    16
    down vote



    accepted










    The main issue is that the pm macro must occur in math mode. To minimize the number of $ symbols needed to enter and exit math mode, I suggest you employ versions of the l, r, and c column types which are in math mode automatically. See the code below for a way to do just that.



    In addition, I would restructure the table to provided separate columns for the counts and percentages.



    And, don't use begincenter and endcenter in a table environment. Instead, use a single centering instruction.



    Finally, I would omit most horizontal lines or, at the very least, replace them with a bit of vertical whitespace. And, do load the booktabs package and use toprule, midrule, and bottomrule for the three remaining horizontal lines.



    enter image description here



    documentclassarticle
    usepackage[utf8]inputenc
    usepackage[english]babel

    usepackagemultirow
    usepackagearray,booktabs % <-- new

    % automatic math-mode column types:
    newcolumntypeL>$l<$ % left-aligned
    newcolumntypeC>$c<$ % centered
    newcolumntypeR>$r<$ % right-aligned

    % two handy shortcut macros:
    newcommandmcC[1]multicolumn2C#1
    newcommandmcR[1]multicolumn2R#1

    begindocument

    begintable[!ptbh]
    captionAn informative table
    smallskip

    centering
    begintabular@l *2R @hspace1mm R R @
    toprule
    &mcC$Female$ & mcC$Male$ & \
    &mcC(N=287) & mcC(N=570) & multirow-2*$p$\
    midrule
    Age & mcR68.7 pm 10.7 & mcR60.6 pm 11.2 & <0.001\
    addlinespace
    CardiogenicShock &&&&& 0.136\
    hspace5mm No &275 & (95.8%) &530 & (93.0%) &\
    hspace5mm Yes & 12 & ( 4.2%) & 40 & (7.0%) &\
    addlinespace
    Entry &&&&&0.035\
    hspace5mm Femoral &119 & (41.5%) &193 & (33.9%) &\
    hspace5mm Radial &168 & (58.5%) &377 & (66.1%) &\
    addlinespace
    DX &&&&&0.012\
    hspace5mm NSTEMI &50 & (17.4%) &103 & (18.1%) &\
    hspace5mm STEMI &84 & (29.3%) &220 & (38.6%) &\
    hspace5mm Unstable Angina&153 & (53.3%) &247 & (43.3%) &\
    addlinespace
    EF & mcR56.3 pm 10.1 & mcR55.6 pm 9.4 &0.387\
    addlinespace
    Height & mcR153.8pm 6.2 & mcR167.9pm 6.1&< 0.001\
    addlinespace
    Weight & mcR57.2 pm 9.3 & mcR68.7 pm 10.3 &< 0.001\
    addlinespace
    BMI & mcR24.2 pm 3.6 & mcR24.3 pm 3.2 &0.611\
    addlinespace
    Obesity &&&&&0.580\
    hspace5mm No &194 & (67.6%) &373 & (65.4%) &\
    hspace5mm Yes & 93 & (32.4%) &197 & (34.6%) &\
    addlinespace
    TC & mcR188.9pm 51.1 & mcR183.3pm 45.9 &0.124\
    addlinespace
    LDLC & mcR117.8pm 41.2 & mcR116.0pm 41.1 &0.561\
    addlinespace
    HDLC & mcR39.0 pm 11.5 & mcR37.8 pm 10.9 &0.145\
    addlinespace
    TG & mcR119.9pm 76.2 & mcR127.9pm 97.3 &0.195\
    addlinespace
    DM &&&&&0.077\
    hspace5mm No &173 & (60.3%) &380 & (66.7%) &\
    hspace5mm Yes &114 & (39.7%) &190 & (33.3%) &\
    addlinespace
    HBP &&&&&< 0.001\
    hspace5mm No & 83 & (28.9%) &273 & (47.9%) &\
    hspace5mm Yes &204 & (71.1%) &297 & (52.1%) &\
    addlinespace
    Smoking &&&&&< 0.001\
    hspace5mm Ex-smoker & 49 & (17.1%) &155 & (27.2%) &\
    hspace5mm Never &209 & (72.8%) &123 & (21.6%) &\
    hspace5mm Smoker & 29 & (10.1%) &292 & (51.2%) &\
    bottomrule
    endtabular
    endtable
    enddocument





    share|improve this answer


















    • 1




      thank you. one last enquiry. i got this symbol (±) initially before I replaced it with pm. I was not rendered and showed error. Do you know how to render it without adding pm? @DavidCarlisle
      – Omar113
      11 hours ago







    • 3




      @Omar113 - I take it that you're using pdfLaTeX. To typeset the Unicode symbol ± directly, i.e., without first changing it over to pm, you need to use a unicode-aware typesetting engine (such as XeLaTeX and LuaLaTeX) as well as a font that includes this symbol.
      – Mico
      11 hours ago















    up vote
    16
    down vote



    accepted










    The main issue is that the pm macro must occur in math mode. To minimize the number of $ symbols needed to enter and exit math mode, I suggest you employ versions of the l, r, and c column types which are in math mode automatically. See the code below for a way to do just that.



    In addition, I would restructure the table to provided separate columns for the counts and percentages.



    And, don't use begincenter and endcenter in a table environment. Instead, use a single centering instruction.



    Finally, I would omit most horizontal lines or, at the very least, replace them with a bit of vertical whitespace. And, do load the booktabs package and use toprule, midrule, and bottomrule for the three remaining horizontal lines.



    enter image description here



    documentclassarticle
    usepackage[utf8]inputenc
    usepackage[english]babel

    usepackagemultirow
    usepackagearray,booktabs % <-- new

    % automatic math-mode column types:
    newcolumntypeL>$l<$ % left-aligned
    newcolumntypeC>$c<$ % centered
    newcolumntypeR>$r<$ % right-aligned

    % two handy shortcut macros:
    newcommandmcC[1]multicolumn2C#1
    newcommandmcR[1]multicolumn2R#1

    begindocument

    begintable[!ptbh]
    captionAn informative table
    smallskip

    centering
    begintabular@l *2R @hspace1mm R R @
    toprule
    &mcC$Female$ & mcC$Male$ & \
    &mcC(N=287) & mcC(N=570) & multirow-2*$p$\
    midrule
    Age & mcR68.7 pm 10.7 & mcR60.6 pm 11.2 & <0.001\
    addlinespace
    CardiogenicShock &&&&& 0.136\
    hspace5mm No &275 & (95.8%) &530 & (93.0%) &\
    hspace5mm Yes & 12 & ( 4.2%) & 40 & (7.0%) &\
    addlinespace
    Entry &&&&&0.035\
    hspace5mm Femoral &119 & (41.5%) &193 & (33.9%) &\
    hspace5mm Radial &168 & (58.5%) &377 & (66.1%) &\
    addlinespace
    DX &&&&&0.012\
    hspace5mm NSTEMI &50 & (17.4%) &103 & (18.1%) &\
    hspace5mm STEMI &84 & (29.3%) &220 & (38.6%) &\
    hspace5mm Unstable Angina&153 & (53.3%) &247 & (43.3%) &\
    addlinespace
    EF & mcR56.3 pm 10.1 & mcR55.6 pm 9.4 &0.387\
    addlinespace
    Height & mcR153.8pm 6.2 & mcR167.9pm 6.1&< 0.001\
    addlinespace
    Weight & mcR57.2 pm 9.3 & mcR68.7 pm 10.3 &< 0.001\
    addlinespace
    BMI & mcR24.2 pm 3.6 & mcR24.3 pm 3.2 &0.611\
    addlinespace
    Obesity &&&&&0.580\
    hspace5mm No &194 & (67.6%) &373 & (65.4%) &\
    hspace5mm Yes & 93 & (32.4%) &197 & (34.6%) &\
    addlinespace
    TC & mcR188.9pm 51.1 & mcR183.3pm 45.9 &0.124\
    addlinespace
    LDLC & mcR117.8pm 41.2 & mcR116.0pm 41.1 &0.561\
    addlinespace
    HDLC & mcR39.0 pm 11.5 & mcR37.8 pm 10.9 &0.145\
    addlinespace
    TG & mcR119.9pm 76.2 & mcR127.9pm 97.3 &0.195\
    addlinespace
    DM &&&&&0.077\
    hspace5mm No &173 & (60.3%) &380 & (66.7%) &\
    hspace5mm Yes &114 & (39.7%) &190 & (33.3%) &\
    addlinespace
    HBP &&&&&< 0.001\
    hspace5mm No & 83 & (28.9%) &273 & (47.9%) &\
    hspace5mm Yes &204 & (71.1%) &297 & (52.1%) &\
    addlinespace
    Smoking &&&&&< 0.001\
    hspace5mm Ex-smoker & 49 & (17.1%) &155 & (27.2%) &\
    hspace5mm Never &209 & (72.8%) &123 & (21.6%) &\
    hspace5mm Smoker & 29 & (10.1%) &292 & (51.2%) &\
    bottomrule
    endtabular
    endtable
    enddocument





    share|improve this answer


















    • 1




      thank you. one last enquiry. i got this symbol (±) initially before I replaced it with pm. I was not rendered and showed error. Do you know how to render it without adding pm? @DavidCarlisle
      – Omar113
      11 hours ago







    • 3




      @Omar113 - I take it that you're using pdfLaTeX. To typeset the Unicode symbol ± directly, i.e., without first changing it over to pm, you need to use a unicode-aware typesetting engine (such as XeLaTeX and LuaLaTeX) as well as a font that includes this symbol.
      – Mico
      11 hours ago













    up vote
    16
    down vote



    accepted







    up vote
    16
    down vote



    accepted






    The main issue is that the pm macro must occur in math mode. To minimize the number of $ symbols needed to enter and exit math mode, I suggest you employ versions of the l, r, and c column types which are in math mode automatically. See the code below for a way to do just that.



    In addition, I would restructure the table to provided separate columns for the counts and percentages.



    And, don't use begincenter and endcenter in a table environment. Instead, use a single centering instruction.



    Finally, I would omit most horizontal lines or, at the very least, replace them with a bit of vertical whitespace. And, do load the booktabs package and use toprule, midrule, and bottomrule for the three remaining horizontal lines.



    enter image description here



    documentclassarticle
    usepackage[utf8]inputenc
    usepackage[english]babel

    usepackagemultirow
    usepackagearray,booktabs % <-- new

    % automatic math-mode column types:
    newcolumntypeL>$l<$ % left-aligned
    newcolumntypeC>$c<$ % centered
    newcolumntypeR>$r<$ % right-aligned

    % two handy shortcut macros:
    newcommandmcC[1]multicolumn2C#1
    newcommandmcR[1]multicolumn2R#1

    begindocument

    begintable[!ptbh]
    captionAn informative table
    smallskip

    centering
    begintabular@l *2R @hspace1mm R R @
    toprule
    &mcC$Female$ & mcC$Male$ & \
    &mcC(N=287) & mcC(N=570) & multirow-2*$p$\
    midrule
    Age & mcR68.7 pm 10.7 & mcR60.6 pm 11.2 & <0.001\
    addlinespace
    CardiogenicShock &&&&& 0.136\
    hspace5mm No &275 & (95.8%) &530 & (93.0%) &\
    hspace5mm Yes & 12 & ( 4.2%) & 40 & (7.0%) &\
    addlinespace
    Entry &&&&&0.035\
    hspace5mm Femoral &119 & (41.5%) &193 & (33.9%) &\
    hspace5mm Radial &168 & (58.5%) &377 & (66.1%) &\
    addlinespace
    DX &&&&&0.012\
    hspace5mm NSTEMI &50 & (17.4%) &103 & (18.1%) &\
    hspace5mm STEMI &84 & (29.3%) &220 & (38.6%) &\
    hspace5mm Unstable Angina&153 & (53.3%) &247 & (43.3%) &\
    addlinespace
    EF & mcR56.3 pm 10.1 & mcR55.6 pm 9.4 &0.387\
    addlinespace
    Height & mcR153.8pm 6.2 & mcR167.9pm 6.1&< 0.001\
    addlinespace
    Weight & mcR57.2 pm 9.3 & mcR68.7 pm 10.3 &< 0.001\
    addlinespace
    BMI & mcR24.2 pm 3.6 & mcR24.3 pm 3.2 &0.611\
    addlinespace
    Obesity &&&&&0.580\
    hspace5mm No &194 & (67.6%) &373 & (65.4%) &\
    hspace5mm Yes & 93 & (32.4%) &197 & (34.6%) &\
    addlinespace
    TC & mcR188.9pm 51.1 & mcR183.3pm 45.9 &0.124\
    addlinespace
    LDLC & mcR117.8pm 41.2 & mcR116.0pm 41.1 &0.561\
    addlinespace
    HDLC & mcR39.0 pm 11.5 & mcR37.8 pm 10.9 &0.145\
    addlinespace
    TG & mcR119.9pm 76.2 & mcR127.9pm 97.3 &0.195\
    addlinespace
    DM &&&&&0.077\
    hspace5mm No &173 & (60.3%) &380 & (66.7%) &\
    hspace5mm Yes &114 & (39.7%) &190 & (33.3%) &\
    addlinespace
    HBP &&&&&< 0.001\
    hspace5mm No & 83 & (28.9%) &273 & (47.9%) &\
    hspace5mm Yes &204 & (71.1%) &297 & (52.1%) &\
    addlinespace
    Smoking &&&&&< 0.001\
    hspace5mm Ex-smoker & 49 & (17.1%) &155 & (27.2%) &\
    hspace5mm Never &209 & (72.8%) &123 & (21.6%) &\
    hspace5mm Smoker & 29 & (10.1%) &292 & (51.2%) &\
    bottomrule
    endtabular
    endtable
    enddocument





    share|improve this answer














    The main issue is that the pm macro must occur in math mode. To minimize the number of $ symbols needed to enter and exit math mode, I suggest you employ versions of the l, r, and c column types which are in math mode automatically. See the code below for a way to do just that.



    In addition, I would restructure the table to provided separate columns for the counts and percentages.



    And, don't use begincenter and endcenter in a table environment. Instead, use a single centering instruction.



    Finally, I would omit most horizontal lines or, at the very least, replace them with a bit of vertical whitespace. And, do load the booktabs package and use toprule, midrule, and bottomrule for the three remaining horizontal lines.



    enter image description here



    documentclassarticle
    usepackage[utf8]inputenc
    usepackage[english]babel

    usepackagemultirow
    usepackagearray,booktabs % <-- new

    % automatic math-mode column types:
    newcolumntypeL>$l<$ % left-aligned
    newcolumntypeC>$c<$ % centered
    newcolumntypeR>$r<$ % right-aligned

    % two handy shortcut macros:
    newcommandmcC[1]multicolumn2C#1
    newcommandmcR[1]multicolumn2R#1

    begindocument

    begintable[!ptbh]
    captionAn informative table
    smallskip

    centering
    begintabular@l *2R @hspace1mm R R @
    toprule
    &mcC$Female$ & mcC$Male$ & \
    &mcC(N=287) & mcC(N=570) & multirow-2*$p$\
    midrule
    Age & mcR68.7 pm 10.7 & mcR60.6 pm 11.2 & <0.001\
    addlinespace
    CardiogenicShock &&&&& 0.136\
    hspace5mm No &275 & (95.8%) &530 & (93.0%) &\
    hspace5mm Yes & 12 & ( 4.2%) & 40 & (7.0%) &\
    addlinespace
    Entry &&&&&0.035\
    hspace5mm Femoral &119 & (41.5%) &193 & (33.9%) &\
    hspace5mm Radial &168 & (58.5%) &377 & (66.1%) &\
    addlinespace
    DX &&&&&0.012\
    hspace5mm NSTEMI &50 & (17.4%) &103 & (18.1%) &\
    hspace5mm STEMI &84 & (29.3%) &220 & (38.6%) &\
    hspace5mm Unstable Angina&153 & (53.3%) &247 & (43.3%) &\
    addlinespace
    EF & mcR56.3 pm 10.1 & mcR55.6 pm 9.4 &0.387\
    addlinespace
    Height & mcR153.8pm 6.2 & mcR167.9pm 6.1&< 0.001\
    addlinespace
    Weight & mcR57.2 pm 9.3 & mcR68.7 pm 10.3 &< 0.001\
    addlinespace
    BMI & mcR24.2 pm 3.6 & mcR24.3 pm 3.2 &0.611\
    addlinespace
    Obesity &&&&&0.580\
    hspace5mm No &194 & (67.6%) &373 & (65.4%) &\
    hspace5mm Yes & 93 & (32.4%) &197 & (34.6%) &\
    addlinespace
    TC & mcR188.9pm 51.1 & mcR183.3pm 45.9 &0.124\
    addlinespace
    LDLC & mcR117.8pm 41.2 & mcR116.0pm 41.1 &0.561\
    addlinespace
    HDLC & mcR39.0 pm 11.5 & mcR37.8 pm 10.9 &0.145\
    addlinespace
    TG & mcR119.9pm 76.2 & mcR127.9pm 97.3 &0.195\
    addlinespace
    DM &&&&&0.077\
    hspace5mm No &173 & (60.3%) &380 & (66.7%) &\
    hspace5mm Yes &114 & (39.7%) &190 & (33.3%) &\
    addlinespace
    HBP &&&&&< 0.001\
    hspace5mm No & 83 & (28.9%) &273 & (47.9%) &\
    hspace5mm Yes &204 & (71.1%) &297 & (52.1%) &\
    addlinespace
    Smoking &&&&&< 0.001\
    hspace5mm Ex-smoker & 49 & (17.1%) &155 & (27.2%) &\
    hspace5mm Never &209 & (72.8%) &123 & (21.6%) &\
    hspace5mm Smoker & 29 & (10.1%) &292 & (51.2%) &\
    bottomrule
    endtabular
    endtable
    enddocument






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 8 hours ago

























    answered 11 hours ago









    Mico

    264k30355733




    264k30355733







    • 1




      thank you. one last enquiry. i got this symbol (±) initially before I replaced it with pm. I was not rendered and showed error. Do you know how to render it without adding pm? @DavidCarlisle
      – Omar113
      11 hours ago







    • 3




      @Omar113 - I take it that you're using pdfLaTeX. To typeset the Unicode symbol ± directly, i.e., without first changing it over to pm, you need to use a unicode-aware typesetting engine (such as XeLaTeX and LuaLaTeX) as well as a font that includes this symbol.
      – Mico
      11 hours ago













    • 1




      thank you. one last enquiry. i got this symbol (±) initially before I replaced it with pm. I was not rendered and showed error. Do you know how to render it without adding pm? @DavidCarlisle
      – Omar113
      11 hours ago







    • 3




      @Omar113 - I take it that you're using pdfLaTeX. To typeset the Unicode symbol ± directly, i.e., without first changing it over to pm, you need to use a unicode-aware typesetting engine (such as XeLaTeX and LuaLaTeX) as well as a font that includes this symbol.
      – Mico
      11 hours ago








    1




    1




    thank you. one last enquiry. i got this symbol (±) initially before I replaced it with pm. I was not rendered and showed error. Do you know how to render it without adding pm? @DavidCarlisle
    – Omar113
    11 hours ago





    thank you. one last enquiry. i got this symbol (±) initially before I replaced it with pm. I was not rendered and showed error. Do you know how to render it without adding pm? @DavidCarlisle
    – Omar113
    11 hours ago





    3




    3




    @Omar113 - I take it that you're using pdfLaTeX. To typeset the Unicode symbol ± directly, i.e., without first changing it over to pm, you need to use a unicode-aware typesetting engine (such as XeLaTeX and LuaLaTeX) as well as a font that includes this symbol.
    – Mico
    11 hours ago





    @Omar113 - I take it that you're using pdfLaTeX. To typeset the Unicode symbol ± directly, i.e., without first changing it over to pm, you need to use a unicode-aware typesetting engine (such as XeLaTeX and LuaLaTeX) as well as a font that includes this symbol.
    – Mico
    11 hours ago











    up vote
    13
    down vote













    pm is a math command so the first error you get is about that and recovers by adding $ so your input is equivalent to $pm then you get a second error at the end of the cell that a second $ to close math mode is missing. use $68.7 pm 10.7$ and similarly use math for all the numeric entries whether or not they have pm so they are all set in the same font.






    share|improve this answer
























      up vote
      13
      down vote













      pm is a math command so the first error you get is about that and recovers by adding $ so your input is equivalent to $pm then you get a second error at the end of the cell that a second $ to close math mode is missing. use $68.7 pm 10.7$ and similarly use math for all the numeric entries whether or not they have pm so they are all set in the same font.






      share|improve this answer






















        up vote
        13
        down vote










        up vote
        13
        down vote









        pm is a math command so the first error you get is about that and recovers by adding $ so your input is equivalent to $pm then you get a second error at the end of the cell that a second $ to close math mode is missing. use $68.7 pm 10.7$ and similarly use math for all the numeric entries whether or not they have pm so they are all set in the same font.






        share|improve this answer












        pm is a math command so the first error you get is about that and recovers by adding $ so your input is equivalent to $pm then you get a second error at the end of the cell that a second $ to close math mode is missing. use $68.7 pm 10.7$ and similarly use math for all the numeric entries whether or not they have pm so they are all set in the same font.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 11 hours ago









        David Carlisle

        469k3810981823




        469k3810981823




















            Omar113 is a new contributor. Be nice, and check out our Code of Conduct.









             

            draft saved


            draft discarded


















            Omar113 is a new contributor. Be nice, and check out our Code of Conduct.












            Omar113 is a new contributor. Be nice, and check out our Code of Conduct.











            Omar113 is a new contributor. Be nice, and check out our Code of Conduct.













             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f453165%2fwhy-is-latex-missing-when-i-have-no-mathematical-equation-and-how-do-i-center%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            What does second last employer means? [closed]

            Installing NextGIS Connect into QGIS 3?

            One-line joke