Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In the middle of typing up an assessment and trying to work out how to get equations to work inside a table environment

\documentclass [11pt] {article}
\usepackage{amsmath}
\usepackage{pdflscape}
\usepackage{float}
\restylefloat{table}
\begin{document}


\title{CSC3407 assessment one }
\author{My name My student number}
\date{09/03/2013}
\maketitle
\tableofcontents
\newpage

\begin{landscape}

\section{Question 3}
Fill the answers in the blanks in the two tables below. You need to provide the working process for each answer.
\subsection{A}
The network mask that supports: 
\begin{table}[H]
    \begin{tabular}{|l|l|l|}
        \hline
       Classful Network & Required borrowed subnet bits & The mask that supports the required subnets \\ \hline
        100.0.0.0 & 12 & 8 bits for class A + 12 bits for subnet = $ 11111111.11111111.11110000.00000000 =1x2^7+1x2^6+1x2^5+1x2^4+1x2^3+1x2^2+1x2^1+1x2^0= 255$   \\ 

        \hline
    \end{tabular}
\end{table}
\end{landscape}

\end{document}

The equation I need to split is 100.0.0.0 & 12 & 8 bits for class A + 12 bits for subnet = $ 11111111.11111111.11110000.00000000 =1x2^7+1x2^6+1x2^5+1x2^4+1x2^3+1x2^2+1x2^1+1x2^0= 255$ \

If I could get the 1x2^7 ... to sit below the binary rep that would make it really good.

Example

11111111.11111111.11110000.00000000
=1x2^7+1x2^6+1x2^5+1x2^4+1x2^3+1x2^2+1x2^1+1x2^0= 255$
share|improve this question
    
I thought you may need my whole code, Sadly I can no longer edit the post. –  Ausghostdog Mar 14 '13 at 8:15
    
Thanks, I solved the issue as well \begin{table}[H] \begin{tabular}{|l|l|l|} \hline Classful Network & Required borrowed subnet bits & The mask that supports the required subnets \\ \hline 100.0.0.0 & 12 & 8 bits for class A + 12 bits for subnet = $ 11111111.11111111.11110000.00000000$ \\ & &$=1x2^7+1x2^6+1x2^5+1x2^4+1x2^3+1x2^2+1x2^1+1x2^0= 255$ \\ \hline \end{tabular} \end{table} –  Ausghostdog Mar 14 '13 at 8:22
add comment

1 Answer

You can benefit from the aligned environment of amsmath:

\documentclass{article}
\usepackage{amsmath}
\usepackage{pdflscape}

\begin{document}
\begin{landscape}

\section{Question 3}

Fill the answers in the blanks in the two tables below. You need to 
provide the working process for each answer.

\subsection{A}
The network mask that supports:\\[\medskipamount]
\begin{tabular}{|l|l|l|}
\hline
Classful Network & 
  Required borrowed &
  The mask that supports \\
& subnet bits & the required subnets \\ 
\hline
100.0.0.0 & 
  12 &
  8 bits for class A${}+{}$12 bits for subnet%
    $\!\begin{aligned}[t]
    &=\mathtt{11111111.11111111.11110000.00000000} \\
    &=1x2^7+1x2^6+1x2^5+1x2^4+1x2^3\\
    &\qquad{}+1x2^2+1x2^1+1x2^0=255
    \end{aligned}$ \\ 
\hline
\end{tabular}
\end{landscape}

\end{document}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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