0

I am trying to create a matrix in texmaker when using the wizard-->quick tabular i get a table, but I want to have equal spacing between the columns , so at the option i choose fixed column width when i see the code I noticed that

%\usepackage{array} is required

so i place it the pre-amble and hit compile but it doesnot allow me to compile it and goes into a never ending loop

\documentclass[authoryear,preprint,review,12pt]{elsarticle}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools}


\begin{document}

\begin{tabular}{|c|c|c|c|c|}
\hline 
• & \multicolumn{4}{c|}{location} \\ 
\hline 
• & 1 & 2 & 3 & 4 \\ 
\hline 
Average & • & • & • & • \\ 
\hline 
Average measure& • & • & • & • \\ 
\hline 
A & • & • & • & • \\ 
\hline 
B & • & • & • & • \\ 
\hline 
C & • & • & • & • \\ 
\hline 
D & • & • & • & • \\ 
\hline 
E & • & • & • & • \\ 
\hline 
\end{tabular}


\end{document}

Is there a way to set a designated width to the code used above, with out the use of packages ?

5
  • Did you type real bullets in your code?
    – Bernard
    Jul 29, 2014 at 10:01
  • @Bernard no i did not, I used the wizard to create the table
    – George
    Jul 29, 2014 at 10:09
  • Can you copy the *.log into your question or publish it somewhere? Your example runs without any hiccup here on Windows 7 / texlive 2014.
    – Keks Dose
    Jul 29, 2014 at 10:46
  • @KeksDose the example is the one that runs, but when i try to insert p{} for width then i go into an infinite loop and cannot do anything on texmaker, not even copy. The question is if there is a command to set width ?
    – George
    Jul 29, 2014 at 10:54
  • It compiles fine with — note I used the article class as the elsevier package is not installed on my machine.
    – Bernard
    Jul 29, 2014 at 11:11

1 Answer 1

1

Are you looking for something like this:

\documentclass[authoryear,preprint,review,12pt]{elsarticle}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools, array, textcomp}


\begin{document}

\begin{tabular}{*{4}{|p{2cm}}|p{2cm}|}
\hline 
• & \multicolumn{4}{c|}{location} \\ 
\hline 
• & 1 & 2 & 3 & 4 \\ 
\hline 
Average & • & • & • & • \\ 
\hline 
Average measure& • & • & • & • \\ 
\hline 
A & • & • & • & • \\ 
\hline 
B & • & • & • & • \\ 
\hline 
C & • & • & • & • \\ 
\hline 
D & • & • & • & • \\ 
\hline 
E & • & • & • & • \\ 
\hline 
\end{tabular}


\end{document}

By the way: the log-file resides in the same folder than you document. Just go there and open it with an editor.

1
  • thank you , yes something like that, i will fitted to the proper width. I was curious on why the wizard didnt work correctly but i think now i will create them in this fashion. Thank you very much
    – George
    Jul 29, 2014 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.