2

Decided to start learning LaTeX in preparation for graduate school in the fall. I'm trying to create a document containing two columns with tables within the columns. I worked out the kinks after a great deal of searching, and first three tables went fine. Using the same code for the first three tables, but changing the table to two column tables instead of four causes the tables to go to the right column even though there is still sufficient room in the left column. The tables are not too wide either. I'd appreciate any advice on getting the last two tables to appear in the left column rather than the right.

\documentclass[letterpaper, twocolumn, 11pt]{article}

\usepackage[left=.25in,top=.25in,right=.25in,nohead,nofoot]{geometry}

\usepackage[compact]{titlesec}
\titlespacing{\section}{0pt}{*0}{*0}

\setlength{\columnsep}{0.5 in}
\setlength{\voffset}{-0.75in}
\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt}
\setlength{\headsep}{0pt}
\setlength{\topskip}{0pt}
\setlength{\topmargin}{0pt}
\setlength{\topsep}{0pt}
\setlength{\partopsep}{0pt}

\begin{document}

    \begin{flushleft}

        \large{\textbf{Useful relations}}

    \end{flushleft}

    \begin{table}[h]

        \centering

        \begin{tabular}{@{}p{0.9in} p{1in} p{0.4in} p{0.9in}@{}}
            \multicolumn{4}{l}{At 298.15 K} \\
            $RT$ & $2.4790\,kJmol^{-1}$ & $RT/F$ & $25.693 mV$ \\ 
            $(RT/F)\,ln\,10$ & $59.160\,mV$ & $kT/hc$ & $207.225\,cm^{-1}$ \\ 
            $kT/e$ & $25.693\,meV$ & $V_m^\Theta$ & $2.4790x10^{-2}$ \newline $m^3mol^{-1}$ \newline $24.790\,dm^3mol^{-1}$

        \end{tabular}

    \end{table}

    \begin{flushleft}

        \large{\textbf{Selected units}}

    \end{flushleft}

    \begin{table}[h]

        \centering

        \begin{tabular}{@{}p{0.4in} p{1.3in} p{0.4in} p{1.3in}@{}}

            1 N & $1\,kg\,m\,s^{-2}$ & 1 J & $1\,kg\,m^{-2}\,s^{-2}$ \\
            1 Pa & $1\,kg\,m^{-1}\,s^{-2}$ & 1 W & $1\,J\,s^{-1}$ \\
            1 V & $1\,J\,C^{-1}$ & 1 A & $1\,C\,s^{-1}$ \\
            1 T & $1\,kg\,s^{-2}\,A^{-1}$ & 1 P & $10^{-1}\,kg\,m^{-1}\,s^{-1}$ \\
            1 S & $1\,\Omega^{-1} = 1\,A\,V^{-1}$

        \end{tabular}

    \end{table}

    \begin{flushleft}

        \large{\textbf{Conversion factors}}

    \end{flushleft}

    \begin{table}[h]

        \centering

        \begin{tabular}{@{}p{0.4in} p{1.3in} p{0.4in} p{1.3in}@{}}


            \multicolumn{4}{l}{$\theta/^{\circ} C = T/K-273.15^{\circ}$} \\
            1 eV & $1.602177x10^{-19}\,J$ \newline $96.485\,kJ\,mol^{-1}$ \newline $8065.5 cm^{-1}$ & 1 cal & 4.184 J \\
            1 atm & $101.325* k\,Pa$ \newline $760* Torr$ & $1\,cm^{-1}$ & $1.9864x10^{-23}\,J$ \\
            1 D & $3.33564x10^{-30}\,C\,m$ & 1 \AA{} & $10^{-10}\,m*$ \\
            \multicolumn{4}{l}{\tiny{* Exact value}}

        \end{tabular}

    \end{table}

    \begin{flushleft}

        \large{\textbf{Mathematical relations}}

    \end{flushleft}

    \begin{table}[h]

        \centering

        \begin{tabular}{@{}p{1.7in} p{1.7in}@{}}

            $\pi = 3.14159265359\,...$ & $\textit{e} = 2.71828182846\,...$

        \end{tabular}

    \end{table}

    \begin{flushleft}

        \large{\textbf{Logarithms and exponentials}}

    \end{flushleft}

    \begin{table}[h]

        \centering

        \begin{tabular}{@{}p{1.7in} p{1.7in}@{}}

            $ln\,x+ln\,y+\,...\,=ln\,xy$ & $ln\,x-ln\,y\,=\,ln\,(x/y)$ \\
            $a\,ln\,x\,=\,ln\,x^a$ & $ln\,x\,=\,(ln\,10)\,log\,x$ \newline $=(2.302585\,...)\,log\,x$ \\
            $\textit{e}^x\textit{e}^y\textit{e}^z\,...\,=\textit{e}^{x+y+z+\,...}$ & $\textit{e}^x/\textit{e}^y\,=\,\textit{e}^{x-y}$ \\
            $(\textit{e}^x)^a\,=\,\textit{e}^{ax}$ & $\textit{e}^{\pm\textit{i}x}\,=\,cos\,x\,\pm\,\textit{i}\,sin\,x$

        \end{tabular}

    \end{table}

\end{document}
  • Welcome! you have several overfull box warnings i.e. things are too wide, even if you say they're not :-). – cfr Mar 16 '18 at 4:11
  • Not sure where things are too wide. The table width is kept under 3.5 inches. – Terin D'Amico Mar 16 '18 at 4:14
  • I do see the overfull box warnings you're mentioning. Trying to play with column widths. – Terin D'Amico Mar 16 '18 at 4:27
  • Thanks for pointing me in the right direction. Wasn't the problem, but did get me looking at the logs. Just had to change [h] to [h!] on the last two tables. – Terin D'Amico Mar 16 '18 at 4:42
  • 2
    Don't do it that way. h means 'here, if there's space'. What if there isn't? LaTeX will change it anyway, to give itself a chance, in the standard classes. Don't want it to float away? Don't use a float. Floats are designed to float. It is their purpose in life. Frustrating that purpose is cruel and unusual punishment, forcing found floats into square holes - generally not entirely successfully. ;) – cfr Mar 16 '18 at 4:45
1

Here's a start. This needs a lot more, but I am out of time. If somebody else picks this up, comment and I'll delete this answer.

To do: use proper environments for the aligned mathematical stuff (amsmath); handle units correctly (siunitx); check for residual abuse of \textit in maths mode and reinsert spacing adjustments when maths code is finalised, as necessary; fix the 7 overfull box warnings by adjusting widths.

\documentclass[letterpaper, twocolumn, 11pt]{article}

\usepackage[left=.25in,top=.25in,right=.25in,nohead,nofoot]{geometry}

\usepackage[compact]{titlesec}
\titlespacing{\section}{0pt}{*0}{*0}

% this is downright sneaky and mean: you load geometry and tell it what you want, but all the while you are deceiving it and next thing you know, you're going behind its back and saying something totally different! if using geometry, the following should all be handled by geometry
% \setlength{\voffset}{-0.75in}% do you really want this? this should be used to allow for a binding or something, I think
% \setlength{\headsep}{0pt}
% \setlength{\topskip}{0pt}
% \setlength{\topmargin}{0pt}% this will give you a top margin of .75" and not .25"
% \setlength{\topsep}{0pt}

\setlength{\columnsep}{0.5 in}
% hmmm ... so you want to provide no indication whatsoever when you start a new paragraph? hope I'm not one of your target readership!
\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt}
% why?!
\setlength{\partopsep}{0pt}

% \setlength\columnseprule{.4pt}% visualise columns

\begin{document}

%   \begin{flushleft}% these look like sub-headings - use \section{} or \section*{} or whatever - or captions - use \caption{} within the float
%     
%     \large\textbf{Useful relations}% \large is a switch - it does not take an argument
%     
%   \end{flushleft}

\subsection*{Useful relations}

\begin{center}% never give h as the sole specifier for a float - it will get changed anyway, as it makes no sense to give this
  \begin{tabular}{@{}p{0.9in} p{1in} p{0.4in} p{0.9in}@{}}

    \multicolumn{4}{l}{At 298.15 K} \\
    $RT$ & $2.4790 kJmol^{-1}$ & $RT/F$ & $25.693 mV$ \\ 
    $(RT/F) ln 10$ & $59.160 mV$ & $kT/hc$ & $207.225 cm^{-1}$ \\ 
    $kT/e$ & $25.693 meV$ & $V_m^\Theta$ & $2.4790x10^{-2}$ \newline $m^3mol^{-1}$ \newline $24.790 dm^3mol^{-1}$

  \end{tabular}
\end{center}

\subsection*{Selected units}

\begin{center}
  \begin{tabular}{@{}p{0.4in} p{1.3in} p{0.4in} p{1.3in}@{}}

    1 N & $1 kg m s^{-2}$ & 1 J & $1 kg m^{-2} s^{-2}$ \\
    1 Pa & $1 kg m^{-1} s^{-2}$ & 1 W & $1 J s^{-1}$ \\
    1 V & $1 J C^{-1}$ & 1 A & $1 C s^{-1}$ \\
    1 T & $1 kg s^{-2} A^{-1}$ & 1 P & $10^{-1} kg m^{-1} s^{-1}$ \\
    1 S & $1 \Omega^{-1} = 1 A V^{-1}$

  \end{tabular}
\end{center}

\subsection*{Conversion factors}

\begin{center}
  \begin{tabular}{@{}p{0.4in} p{1.3in} p{0.4in} p{1.3in}@{}}

    \multicolumn{4}{l}{$\theta/^{\circ} C = T/K-273.15^{\circ}$} \\
    1 eV & $1.602177x10^{-19} J$ \newline $96.485 kJ mol^{-1}$ \newline $8065.5 cm^{-1}$ & 1 cal & 4.184 J \\
    1 atm & $101.325* k Pa$ \newline $760* Torr$ & $1 cm^{-1}$ & $1.9864x10^{-23} J$ \\
    1 D & $3.33564x10^{-30} C m$ & 1 \AA{} & $10^{-10} m*$ \\
    \multicolumn{4}{l}{\tiny{* Exact value}}

  \end{tabular}
\end{center}

\subsection*{Mathematical relations}

\begin{center}
  \begin{tabular}{@{}p{1.7in} p{1.7in}@{}}

    $\pi = 3.14159265359 \dots $ & $e = 2.71828182846 \dots $

  \end{tabular}
\end{center}

\subsection*{Logarithms and exponentials}

\begin{center}
  \begin{tabular}{@{}p{1.7in} p{1.7in}@{}}

    $\ln x+\ln y+ \dots  =\ln xy$ & $\ln x-\ln y = \ln (x/y)$ \\
    $a \ln x = \ln x^a$ & $\ln x = (\ln 10) \log x$ \newline $=(2.302585 \dots ) \log x$ \\
    $e ^xe ^ye ^z \dots  =e ^{x+y+z+ \dots }$ & $e ^x/e ^y = e ^{x-y}$ \\
    $(e ^x)^a = e ^{ax}$ & $e ^{\pm i x} = \cos x \pm i \sin x$

  \end{tabular}
\end{center}

\end{document}

The tables move in the original because there isn't enough vertical space left in the left hand column. Floats float. You don't want them to float here, so don't use floats. Sub-headings should be marked up as such. Operators etc. should be marked-up correctly to get the correct format and consistent spacing. siunitx can be used to handle the units. amsmath will allow you to dispense with tabular in favour of dedicated maths environments, eliminating the endless repetition of dollar signs.

\large is a switch. It does not take an argument.

current status

  • Thanks for the advice. I did manage to correct all but one of the overfull boxes. But the problem with the tables moving to the next column was that the [h] was changed to a [t] dynamically for the last two tables. I changed it to [h!] and the tables moved to the left column. I'll take a look at siunitx. – Terin D'Amico Mar 16 '18 at 4:46
  • @TerinD'Amico Don't. That's a bad way to do it. What if there isn't room? LaTeX will, in standard classes, add t to give itself a chance. You don't want the things to float away, do you? So don't use a float. You should only use floats when you want LaTeX to move things to the 'best' position (by its lights). – cfr Mar 16 '18 at 4:48
  • I made changes as suggested. Without the [h!] on the last two tables, it will still move the tables to the next column. I did fix all the overfull boxes, and made other changes. Thanks for the advice on siunitx. I definitely like the format better. – Terin D'Amico Mar 16 '18 at 6:12
  • OK, shouldn't stare at code after midnight. I made the rest of the changes you had suggested earlier. All works fine. Thank you very much for the education. – Terin D'Amico Mar 16 '18 at 6:43
0

Here is the latest version, which looks fine. But I couldn't do it without the [h!] on the last two tables.

\documentclass[twocolumn, 10pt]{article}

\usepackage[left=.25in,top=.25in,right=.25in,nohead,nofoot]{geometry}
\usepackage{amsmath}
\usepackage{siunitx}

\pagenumbering{gobble}

\begin{document}

    \section*{Useful relations}

    \begin{table}[h]

    \centering

    \begin{tabular}{@{}p{.8in} p{1in} p{0.4in} p{1.2in}@{}}

        \multicolumn{4}{l}{At 298.15 K} \\
        \textit{RT} & \si{2.4790.kJ.mol^{-1}} & $RT/F$ & \si{25.693.{mV}} \\ 
        (\textit{RT/F}) ln 10 & 59.160 mV & \textit{kT/hc} & \si{207.225.cm^{-1}} \\ 
        \textit{kT/e} & 25.693 meV & $V_m^\Theta$ & $2.4790x10^{-2}$ \newline \si{m^3.mol^{-1}} \newline 24.790 \si{dm^3.mol^{-1}}

    \end{tabular}

    \end{table}

    \section*{Selected units}

    \begin{table}[h]

        \centering

        \begin{tabular}{@{}p{0.5in} p{1.2in} p{0.5in} p{1.2in}@{}}

            1 N & \si{1.kg.m.s^{-2}} & 1 J & \si{1.kg.m^{-2}.s^{-2}} \\
            1 Pa & \si{1.kg.m^{-1}.s^{-2}} & 1 W & \si{1.J.s^{-1}} \\
            1 V & \si{1.J.C^{-1}} & 1 A & \si{1.C.s^{-1}} \\
            1 T & \si{1.kg.s^{-2}.A^{-1}} & 1 P & \si{10^{-1}.kg.m^{-1}.s^{-1}} \\
            1 S & \si{1.\Omega^{-1} = 1.A.V^{-1}}

        \end{tabular}

    \end{table}

    \section*{Conversion factors}

    \begin{table}[h]

        \centering

        \begin{tabular}{@{}p{0.5in} p{1.2in} p{0.5in} p{1.2in}@{}}

            \multicolumn{4}{l}{\si{\theta/^{\circ}C = \textit{T}/K-273.15^*}} \\
            1 eV & \si{1.602177x10^{-19}.J} \newline \si{96.485.kJ.mol^{-1}} \newline \si{8065.5.cm^{-1}} & 1 cal & \si{4.184.J} \\
            1 atm & \si{101.325^*.kPa} \newline \si{760^*.Torr} & \si{1.cm^{-1}} & \si{1.9864x10^{-23}.J} \\
            1 D & $3.33564x10^{-30}\,C\,m$ & 1 \AA{} & $10^{-10}\,m^*$ \\
            \multicolumn{4}{l}{* Exact value}

        \end{tabular}

    \end{table}

    \section*{Mathematical relations}

    \begin{table}[h!]

        \centering

        \begin{tabular}{@{}p{1.7in} p{1.7in}@{}}

            \si{\pi = 3.14159265359\ldots} & \si{e = 2.71828182846\ldots}

        \end{tabular}

    \end{table}

    \section*{Logarithms and exponentials}

    \begin{table}[h!]

        \centering

        \begin{tabular}{@{}p{1.7in} p{1.7in}@{}}

            \si{ln.x+ln.y+\ldots=ln.xy\ldots} & \si{ln.x-ln.y=ln(x/y)} \\
            \si{a.ln.x=ln.x^a} & \si{ln.x=(ln.10).log.x} \newline \si{=(2.302585\ldots).log.x} \\
            \si{e^x.e^y.e^z\ldots=e^{x+y+z+\ldots}} & \si{e^x/e^y=e^{x-y}} \\
            \si{(e^x)^a=e^{ax}} & \si{e^{\pm\textit{i}x}=cos.x.\pm.\textit{i}.sin.x}

        \end{tabular}

    \end{table}

    \newpage

\end{document}
  • 1
    never use [h] (or [h!] on its own it greatly increases the chance of the table going to the end of the document as it means that the table is not allowed at top of page (no t) or bottom of page (b) or on a page of tables (p) which doesn't leave many places it is allowed. Normally latex gives a warning and changes it to [ht] to give itself a chance but you should almost always include p if you use the option at all. here though you do not want floats and you have no captions so you should not have a table environment at all, just tabular – David Carlisle Mar 16 '18 at 7:47
0

Just for completeness sake in case someone has the same challenge and finds this question, below is the fully functioning and complete code for the document in which no floats are used to keep tables within a twocolumn document.

\documentclass[twocolumn, 10pt]{article}

\usepackage[left=.25in,top=.25in,right=.25in,nohead,nofoot]{geometry}
\usepackage{amsfonts, amsmath, amssymb}
\usepackage{siunitx}

\pagenumbering{gobble}

\setlength\extrarowheight{6pt}

\begin{document}

    \section*{Useful relations}

    At 298.15 K

    \vspace{-1em}

    \begin{flushleft}

    \begin{tabular}{@{}p{.8in} p{1in} p{0.4in} p{1.2in}@{}}

        \textit{RT} & 2.4790\si{.kJ.mol^{-1}} & $RT/F$ & 25.693\si{.{mV}} \\ 
        (\textit{RT/F})ln 10 & 59.160 mV & \textit{kT/hc} & 207.225\si{.cm^{-1}} \\ 
        \textit{kT/e} & 25.693 meV & $V_m^\Theta$ & $2.4790\times10^{-2}$ \newline \si{m^3.mol^{-1}} \newline 24.790 \si{dm^3.mol^{-1}}

    \end{tabular}

    \end{flushleft}

    \vspace{-2em}

    \section*{Selected units}

    \begin{flushleft}

        \begin{tabular}{@{}p{0.5in} p{1.2in} p{0.5in} p{1.2in}@{}}

            1 N & 1\si{.kg.m.s^{-2}} & 1 J & 1\si{.kg.m^{-2}.s^{-2}} \\
            1 Pa & 1\si{.kg.m^{-1}.s^{-2}} & 1 W & 1\si{.J.s^{-1}} \\
            1 V & 1\si{.J.C^{-1}} & 1 A & 1\si{.C.s^{-1}} \\
            1 T & 1\si{.kg.s^{-2}.A^{-1}} & 1 P & $10^{-1}$\si{.kg.m^{-1}.s^{-1}} \\
            1 S & 1\si{.\Omega^{-1} = 1.A.V^{-1}}

        \end{tabular}

    \end{flushleft}

    \vspace{-2em}

    \section*{Conversion factors}

    $\theta/^{\circ}C = \textit{T}/K-273.15^*$

    \vspace{-1em}

    \begin{flushleft}


        \begin{tabular}{@{}p{0.5in} p{1.2in} p{0.5in} p{1.2in}@{}}

            1 eV & $1.602177\times10^{-19}$\si{.J} \newline $96.485$\si{.kJ.mol^{-1}} \newline $8065.5$\si{.cm^{-1}} & 1 cal & $4.184$\si{.J} \\
            1 atm & $101.325^*$\si{.kPa} \newline \si{760^*.Torr} & 1\si{.cm^{-1}} & $1.9864\times10^{-23}$\si{.J} \\
            1 D & $3.33564x10^{-30}$\si{C.m} & 1 \AA{} & $10^{-10}$\si{m^*} \\

        \end{tabular}

        * Exact value

    \end{flushleft}

    \vspace{-1em}

    \section*{Mathematical relations}

    \begin{flushleft}

        \begin{tabular}{@{}p{1.7in} p{1.7in}@{}}

            \si{\pi = 3.14159265359\ldots} & \si{e = 2.71828182846\ldots}

        \end{tabular}

    \end{flushleft}

    \vspace{-2em}

    \section*{Logarithms and exponentials}

    \begin{flushleft}

        \begin{tabular}{@{}p{1.7in} p{1.7in}@{}}

            \si{ln.x+ln.y+\ldots=ln.xy\ldots} & \si{ln.x-ln.y=ln(x/y)} \\
            \si{a.ln.x=ln.x^a} & \si{ln.x=(ln.10).log.x} \newline =(2.302585\ldots)\si{.log.x} \\
            \si{e^x.e^y.e^z\ldots=e^{x+y+z+\ldots}} & \si{e^x/e^y=e^{x-y}} \\
            \si{(e^x)^a=e^{ax}} & \si{e^{\pm\textit{i}x}=cos.x.\pm.\textit{i}.sin.x}

        \end{tabular}

    \end{flushleft}

    \newpage

    \section*{Series expansions}

    \setlength\extrarowheight{12pt}

    \si{e^x = 1+x+\frac{x^2}{2!}+\frac{x^3}{3!}+\ldots} \\
    \si{ln(1+x)=x-\frac{x^2}{2}+\frac{x^3}{3}-\ldots}

    \begin{flushleft}

        \begin{tabular}{@{}p{1.7in} p{1.7in}@{}}

            \si{\dfrac{1}{1+x}=1-x^2-\ldots} & \si{\dfrac{1}{1-x}=1+x^2+\ldots} \\
            \si{\sin.x=x-\dfrac{x^3}{3!}+\dfrac{x^5}{5!}-\ldots} & \si{\cos.x=1-\dfrac{x^2}{2!}+\dfrac{x^4}{4!}-\ldots}

        \end{tabular}

    \end{flushleft}

    \vspace{-2em}

    \section*{Derivatives}

    \begin{flushleft}

        \begin{tabular}{@{}p{1.3in} p{1.1in} p{1in}@{}}

            $d(f+g)=df+dg$ & $d(f+g)=df+dg$ \\
            $d\dfrac{f}{g}=\dfrac{1}{g}df-\dfrac{f}{g^2}dg$ & \multicolumn{2}{l}{$d\dfrac{df}{dt}=\dfrac{df}{dg}df\dfrac{dg}{dt} for f=f(g(t))$} \\
            $\left(\dfrac{\partial y}{\partial x}\right)_z = 1/\left(\dfrac{\partial x}{\partial x}\right)_z$ & \multicolumn{2}{l}{$\left(\dfrac{\partial y}{\partial x}\right)_z \left(\dfrac{\partial x}{\partial z}\right)_y \left(\dfrac{\partial z}{\partial y}\right)_x = -1$} \\
            $\dfrac{dx^n}{dx}=nx^(n-1)$ & $\dfrac{de^(ax)}{dx}=ae^(ax)$ & $\dfrac{d\,ln(ax)}{dx}=\dfrac{1}{x}$

        \end{tabular}

    $df=g(x,y)dx+h(x,y)dy is exact if \left(\dfrac{\partial g}{\partial y}\right)_x = \left(\dfrac{\partial h}{\partial x}\right)_y$

    \end{flushleft}

        \section*{Greek alphabet}

        \setlength\extrarowheight{8pt}

    \begin{flushleft}

        \begin{tabular}{@{}p{0.3in} p{0.7in} p{0.3in} p{0.7in} p{0.3in} p{0.7in}@{}}

            A,$\alpha$ & alpha & I,$\iota$ & iota & P,$\rho$ & rho \\
            B,$\beta$ & beta & K,$\kappa$ & kappa & $\Sigma,\sigma$ & sigma \\
            $\Gamma,\gamma$ & gamma & $\Lambda,\lambda$ & lambda & T,$\tau$ & tau \\
            $\Delta,\delta$ & delta & M,$\mu$ & mu & $\Upsilon,\upsilon$ & upsilon \\
            E,$\epsilon$ & epsilon & N,$\nu$ & nu & $\Phi,\phi$ & phi \\
            Z,$\zeta$ & zeta & $\Xi,\xi$ & xi & X,$\chi$ & chi \\
            H,$\eta$ & eta & O,o & omicron & $\Psi,\psi$ & psi \\
            $\Theta,\theta$ & theta & $\Pi,\pi$ & pi & $\Omega,\omega$ & omega

        \end{tabular}

    \end{flushleft}

\end{document}

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.