5

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}
5

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}
  • 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 '14 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 '14 at 4:55
  • Ok, I think I need to look more into similar cases. Thanks a lot! – Lawerance Jul 30 '14 at 4:56
2

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}
  • I think this is what I am looking for too. Thanks a lot! – Lawerance Jul 30 '14 at 5:00
  • @Lawerance -- You are welcome. – Jesse Jul 30 '14 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 '14 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 '14 at 10:20
  • Got it! i Think I will just do newcommand, because it is more flexible. – Lawerance Jul 30 '14 at 16:18
1

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

  • 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 '14 at 16:17

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.