newtothis
newtothis

Reputation: 525

How to move table to the left or not exceed the right margin?

I am using Overleaf to take notes in my classes and I am running into trouble with a tabular column I am trying to create. My code is the following:

\begin{center}
    \begin{tabular}{|c|c|}
    \hline
    Crystalline Solids & Non-Crsytalline Solids \\
    \hline 
    i. Atoms and molecules are periodic in space & i. Atoms and molecules are not periodic in space \\
    \hline 
    ii. Some crystalline solids are anisotopic \\ 
    i.e the magnitudes of the physical properties like \\
    refractive index, electrical conductivity are \\
    different along difference directions \\  & ii. Physical properties are isotropic \\
    \hline 
    iii. Have sharp melting points & iii. Do not have sharp boiling points - a range is present \\
    \hline 
    iv. Breaks are observed in the cooling curve & iv. No breaks in cooling curve \\
    \hline 
    v. Breaks along sharp edges i.e breaks \\ 
    along specific "crystallographic planes" & v. Broken surfaces are irregular because there are no crystal planes \\
    \hline 
    \end{tabular}
\end{center}

The problem is that now my table appears like so. https://i.sstatic.net/kmaYg.jpg I have tried using the \begin{table} environment and the \begin{figure} environment but even after using qualifiers like [h] or [ht] the table's position in the text also changes, and the alignment is still off. How do I correct this to fit it into the page?

Upvotes: 0

Views: 8161

Answers (1)

Werner
Werner

Reputation: 15065

c, l and r columns don't wrap their contents. You'll have to use a fixed-width p{<len>} column for your tabular, or consider using tabularx.

Here's an option with a paragraph-style column specification:

enter image description here

\documentclass{article}

\usepackage{booktabs}

\begin{document}

\begin{center}
  \begin{tabular}{ l p{.45\linewidth} p{.45\linewidth} }
    \toprule
         & \multicolumn{1}{c}{Crystalline Solids} & 
          \multicolumn{1}{c}{Non-Crystalline Solids} \\
    \midrule
    i.   & Atoms and molecules are periodic in space & 
      Atoms and molecules are not periodic in space \\
    ii.  & Some crystalline solids are anisotopic \textit{i.e.}~the magnitudes of the physical properties 
      like refractive index, electrical conductivity are different along difference directions & 
        Physical properties are isotropic \\
    iii. & Have sharp melting points & 
      Do not have sharp boiling points --- a range is present \\
    iv. & Breaks are observed in the cooling curve & 
      No breaks in cooling curve \\
    v. & Breaks along sharp edges i.e breaks along specific ``crystallographic planes'' & 
      Broken surfaces are irregular because there are no crystal planes \\
    \bottomrule 
  \end{tabular}
\end{center}

\end{document}

Here's a similar option using tabularx:

enter image description here

\documentclass{article}

\usepackage{tabularx,booktabs}

\begin{document}

\noindent
\begin{tabularx}{\linewidth}{ l X X }
  \toprule
       & \multicolumn{1}{c}{Crystalline Solids} & 
        \multicolumn{1}{c}{Non-Crystalline Solids} \\
  \midrule
  i.   & Atoms and molecules are periodic in space & 
    Atoms and molecules are not periodic in space \\
  ii.  & Some crystalline solids are anisotopic \textit{i.e.}~the magnitudes of the physical properties 
    like refractive index, electrical conductivity are different along difference directions & 
      Physical properties are isotropic \\
  iii. & Have sharp melting points & 
    Do not have sharp boiling points~--- a range is present \\
  iv. & Breaks are observed in the cooling curve & 
    No breaks in cooling curve \\
  v. & Breaks along sharp edges i.e breaks along specific ``crystallographic planes'' & 
    Broken surfaces are irregular because there are no crystal planes \\
  \bottomrule 
\end{tabularx}

\end{document}

Upvotes: 1

Related Questions