Why is LaTeX missing $ when I have no mathematical equation and how do I center the table?
Clash 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?
tables
New contributor
add a comment |Â
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?
tables
New contributor
8
Hi, welcome. As a first step, note thatpm
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
add a comment |Â
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?
tables
New contributor
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
tables
New contributor
New contributor
edited 15 mins ago
Peter Mortensen
49936
49936
New contributor
asked 12 hours ago
Omar113
482
482
New contributor
New contributor
8
Hi, welcome. As a first step, note thatpm
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
add a comment |Â
8
Hi, welcome. As a first step, note thatpm
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
add a comment |Â
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.
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
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 topm
, 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
add a comment |Â
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.
add a comment |Â
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.
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
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 topm
, 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
add a comment |Â
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.
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
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 topm
, 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
add a comment |Â
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.
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
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.
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
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 topm
, 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
add a comment |Â
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 topm
, 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
add a comment |Â
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.
add a comment |Â
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.
add a comment |Â
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.
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.
answered 11 hours ago
David Carlisle
469k3810981823
469k3810981823
add a comment |Â
add a comment |Â
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.
Omar113 is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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