Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mysterious \multicolumn{1} environments #27

Open
EliGurarie opened this issue Nov 9, 2018 · 3 comments
Open

Mysterious \multicolumn{1} environments #27

EliGurarie opened this issue Nov 9, 2018 · 3 comments

Comments

@EliGurarie
Copy link

Fun package, thanks. However, for some mysterious reason, the converter adds all kinds of \multicolumn{1}{...} environments for no apparent reason that I could figure out.

For example, in this simple table:

study agency N n.obs years n.years
Western Arctic NPS / ADFG 128 114.6 2009-2018 10
Porcupine ADFG / GY-DE 175 88.8 1998-2018 21
Cape Bathurst NT-ENR 83 56.8 1996-2017 22
Bluenose West - 159 83.1 1996-2017 22
Bluenose East - 219 96.1 2005-2018 14
Bathurst - 179 80.2 1996-2018 23
Beverly and Ahiak - 105 70.1 1995-2018 17
total   1048 589.7   129

The latex code looks like:

% Table generated by Excel2LaTeX from sheet 'Sheet1'
\begin{tabular}{p{6.855em}lllll}
study                              & \multicolumn{1}{p{6.07em}}{agency} & \multicolumn{1}{p{2.215em}}{N}     & \multicolumn{1}{p{2.785em}}{n.obs} & \multicolumn{1}{p{4.645em}}{years} & \multicolumn{1}{p{3.355em}}{n.years} \\
Western Arctic                     & \multicolumn{1}{p{6.07em}}{NPS / ADFG} & 128                                & 114.6                              & \multicolumn{1}{p{4.645em}}{2009-2018} & 10 \\
Porcupine                          & \multicolumn{1}{p{6.07em}}{ADFG / GY-DE} & 175                                & 88.8                               & \multicolumn{1}{p{4.645em}}{1998-2018} & 21 \\
Cape Bathurst                      & \multicolumn{1}{p{6.07em}}{NT-ENR} & 83                                 & 56.8                               & \multicolumn{1}{p{4.645em}}{1996-2017} & 22 \\
Bluenose West                      & \multicolumn{1}{p{6.07em}}{-}      & 159                                & 83.1                               & \multicolumn{1}{p{4.645em}}{1996-2017} & 22 \\
Bluenose East                      & \multicolumn{1}{p{6.07em}}{-}      & 219                                & 96.1                               & \multicolumn{1}{p{4.645em}}{2005-2018} & 14 \\
Bathurst                           & \multicolumn{1}{p{6.07em}}{-}      & 179                                & 80.2                               & \multicolumn{1}{p{4.645em}}{1996-2018} & 23 \\
Beverly and Ahiak                  & \multicolumn{1}{p{6.07em}}{-}      & 105                                & 70.1                               & \multicolumn{1}{p{4.645em}}{1995-2018} & 17 \\
total                              &                                    & 1048                               & 589.7                              &                                    & 129 \\
\end{tabular}%

I think I would spend about as much time removing all those \multicolumn{1}{p{6.07em}} as formatting the LaTeX table by hand!

Any explanation? Or, better yet, any chance to make this behavior start?

Thanks

@krlmlr
Copy link
Collaborator

krlmlr commented Nov 9, 2018

Can you try resetting the width of that column?

\multicolumn{} is normally used for merged cells, perhaps you need to un-merge?

It would help if you could share the file.

@EliGurarie
Copy link
Author

I have tried resetting, widening them enormously, etc. There was no merging or unmerging. Just - weird.

excel2latextest.xlsx
The file is attached.

@KnickerPicker
Copy link

It seems that the problem lies in text wrapping. When disabling this in your document, the \multicolumn{} went away.
As mentioned in the update from 2017: "Cells that con­tain text and have text wrap­ping set will be placed in p columns" (https://www.ctan.org/ctan-ann/id/[email protected]).

Also, it appears that any other inconsitency in alignment, bordering, (etc.?) would result in multicomns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants