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.

I want to achieve what the picture shows below. Basically, I want those two very long text lines to split into two lines shown below. My major problem is that if I keep the text in one line in flalign, then the entire right-side text will shift to the left. Here is my code.

enter image description here

\documentclass[a4paper]{article}
\usepackage{mathtools}
\usepackage{nccmath}
\usepackage[margin=1in]{geometry}

\newcommand \widebox[1]{\setlength\fboxsep{6pt}\boxed {\enspace#1\enspace}}
\newcommand \dpartial[2]{\frac{\partial #1}{\partial #2}}
\newcommand \ddef[2]{\frac{d #1}{d #2}}
\newcommand \spac{\\[0.6em]}

\setlength\parindent{0pt}
\numberwithin{equation}{section}

\title{\vspace{-5em} QM Formula List}
\author{David}
\date{}

\begin{document}
\maketitle
\begin{flalign*}
   &i\hbar \dpartial{\Psi}{t} = -\frac{\hbar ^2}{2m}\dpartial{^2 \Psi}{x^2}+V\Psi &&\text{Shr\"odinger Equation}\spac
   &\widehat{p} = -i \hbar \dpartial{}{x}                                         &&\text{Momentim Operator} \spac
   &\widehat{H} = -\frac{\hbar ^2}{2m} \ddef{^2 \psi}{x^2} + V                    &&\text{Energy Operator} \spac
   &-\frac{\hbar^2}{2m}\ddef{^2 \psi}{x^2} + V \psi = E \psi                      &&\text{Time-independent Schr\"odinger Equation} \spac
\end{flalign*}
\end{document}
share|improve this question

3 Answers 3

up vote 5 down vote accepted

Set the item in a tabular:

enter image description here

\documentclass[a4paper]{article}
\usepackage{mathtools}
\usepackage{nccmath}
\usepackage[margin=1in]{geometry}

\newcommand \widebox[1]{\setlength\fboxsep{6pt}\boxed {\enspace#1\enspace}}
\newcommand \dpartial[2]{\frac{\partial #1}{\partial #2}}
\newcommand \ddef[2]{\frac{d #1}{d #2}}
\newcommand \spac{\\[0.6em]}

\setlength\parindent{0pt}
\numberwithin{equation}{section}

\title{\vspace{-5em} QM Formula List}
\author{David}
\date{}

\begin{document}
\maketitle
\begin{flalign*}
   &i\hbar \dpartial{\Psi}{t} = -\frac{\hbar ^2}{2m}\dpartial{^2 \Psi}{x^2}+V\Psi &&\text{Shr\"odinger Equation}\spac
   &\widehat{p} = -i \hbar \dpartial{}{x}                                         &&\text{Momentim Operator} \spac
   &\widehat{H} = -\frac{\hbar ^2}{2m} \ddef{^2 \psi}{x^2} + V                    &&\text{Energy Operator} \spac
   &-\frac{\hbar^2}{2m}\ddef{^2 \psi}{x^2} + V \psi = E \psi                      &&\begin{tabular}{@{}l@{}}Time-independent \\ Schr\"odinger Equation\end{tabular} \spac
\end{flalign*}
\end{document}
share|improve this answer
    
It works! But somehow, I feel the format is weird, because it's not very common to put one environment into another, here tabular into flalign. –  Lawerance Jul 30 at 4:47
1  
@Lawerance: Says who?! :) You can define \newcommand \texttab[1]{\begin{tabular}{@{}l@{}}#1\end{tabular}} and then use \texttab{... \\ ...} if that is more appealing. –  Werner Jul 30 at 4:55
    
Ok, I think I need to look more into similar cases. Thanks a lot! –  Lawerance Jul 30 at 4:56

Use of parbox[length]{content} is another option.

enter image description here

Code

\documentclass[a4paper]{article}
\usepackage{mathtools}
\usepackage{nccmath}
\usepackage[margin=1in]{geometry}

\newcommand \widebox[1]{\setlength\fboxsep{6pt}\boxed {\enspace#1\enspace}}
\newcommand \dpartial[2]{\frac{\partial #1}{\partial #2}}
\newcommand \ddef[2]{\frac{d #1}{d #2}}
\newcommand \spac{\\[0.6em]}

\setlength\parindent{0pt}
\numberwithin{equation}{section}

\title{\vspace{-5em} QM Formula List}
\author{David}
\date{}

\begin{document}
\maketitle
\begin{flalign*}
   &i\hbar \dpartial{\Psi}{t} = -\frac{\hbar ^2}{2m}\dpartial{^2 \Psi}{x^2}+V\Psi &&\text{Shr\"odinger Equation}\spac
   &\widehat{p} = -i \hbar \dpartial{}{x}                                         &&\text{Momentim Operator} \spac
   &\widehat{H} = -\frac{\hbar ^2}{2m} \ddef{^2 \psi}{x^2} + V                    &&\text{Energy Operator} \spac
   &-\frac{\hbar^2}{2m}\ddef{^2 \psi}{x^2} + V \psi = E \psi                      &&\parbox{4cm}{Time-independent Schr\"odinger Equation} \spac
\end{flalign*}
\end{document}
share|improve this answer
    
I think this is what I am looking for too. Thanks a lot! –  Lawerance Jul 30 at 5:00
    
@Lawerance -- You are welcome. –  Jesse Jul 30 at 5:01
    
I just found a minor problem. If we use \parabox, it is hard to keep the same space between characters in box as the one in the \text. For example, in &&\parbox{5.3cm}{General Solution to the Separable Shr\"odinger Equation} \spac, I need to keep adjusting the width until it becomes roughly the same as the one in \text. Do you have any better idea? –  Lawerance Jul 30 at 6:01
    
Hi, thanks for being patient for this late response. Indeed, that is a feature of the solution; A possible improvement is to determine the text length of ALL (called \abc) and use a macro, taking 1 argument, like \newcommand{\mytextwidth}[1]{\parbox[\widthof{\abc}]{#1} } which needs calc package. –  Jesse Jul 30 at 10:20
    
Got it! i Think I will just do newcommand, because it is more flexible. –  Lawerance Jul 30 at 16:18

Your formulae are on left margin. To have them (more) centred, you should add a pair of && in front of them. If you want them to be really centred, you can use the alignat* environment:

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{nccmath}
\usepackage[margin=1in, showframe]{geometry}
\usepackage{stackengine}
\setstackEOL{\\}

\newcommand \widebox[1]{\setlength\fboxsep{6pt}\boxed {\enspace#1\enspace}}
\newcommand \dpartial[2]{\frac{\partial #1}{\partial #2}}
\newcommand \ddef[2]{\frac{d #1}{d #2}}
\newcommand \spac{\\[0.6em]}

\setlength\parindent{0pt}
\numberwithin{equation}{section}

\title{\vspace{-5em} QM Formula List}
\author{David}
\date{}

\begin{document}
\maketitle
\begin{flalign*}
  &  &   &i\hbar \dpartial{\Psi}{t} = -\frac{\hbar ^2}{2m}\dpartial{^2 \Psi}{x^2}+V\Psi &&\text{Shrödinger Equation}\spac
  &  &   &\widehat{p} = -i \hbar \dpartial{}{x}                                         && \text{Momentum Operator}\spac
  &  &   &\widehat{H} = -\frac{\hbar ^2}{2m} \ddef{^2 \psi}{x^2} + V    &&\text{Energy Operator} \spac
   &  &  &-\frac{\hbar^2}{2m}\ddef{^2 \psi}{x^2} + V \psi = E \psi      & &\Centerstack[l]{Time-independent\\ Schrödinger Equation} \spac
\end{flalign*}
\vskip2ex
\begin{alignat*}{2}
   &i\hbar \dpartial{\Psi}{t} = -\frac{\hbar ^2}{2m}\dpartial{^2 \Psi}{x^2}+V\Psi &&\text{\rlap{\hspace{4em}Shrödinger Equation}}\spac
   &\widehat{p} = -i \hbar \dpartial{}{x}                                         & &\text{\rlap{\hspace{4em}Momentum Operator}}\spac
   &\widehat{H} = -\frac{\hbar ^2}{2m} \ddef{^2 \psi}{x^2} + V    &&\text{\rlap{\hspace{4em}Energy Operator}} \spac
   &-\frac{\hbar^2}{2m}\ddef{^2 \psi}{x^2} + V \psi = E \psi      &&\rlap{\hspace{4em}\Centerstack[l]{Time-independent\\ Schrödinger Equation}} \spac
\end{alignat*}

\end{document} 

enter image description here

share|improve this answer
    
Thanks still! But I want the equations to be displayed on the left and text the left, because there will be hundreds of them. –  Lawerance Jul 30 at 16:17

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.