6

Input:

\begin{equation}
\begin{split}
democ_{i,t}={} & \alpha\,democ_{i,t-5} \quad+\quad 
\beta\,students\;abroad_{i,t-5} \quad+\quad \\ & 
\gamma\,democ.\;in\;receiving\;countries_{i,t-5} \quad+\quad\ \\ & 
\delta\,(students\;abroad_{i,t- 
5}*democ.\;in\;receiving\;countries_{i,t-5}) \quad+\quad \\ & 
country\;fixed\;effects_i \quad+\quad time\;fixed\;effects_t 
\quad+\quad \epsilon_{i,t}
\end{split}
\end{equation}

Output: enter image description here Why is there extra spacing between the f's in 'effects' when every other word is properly spaced? How do I fix it?

9
  • You have to use \text{} from amsmath package. Otherwise, it is not a text, but a sequence of math variables.
    – Sigur
    Nov 4, 2018 at 2:41
  • @Sigur Those are variables and not text so I want them to be like that. Will I have to use \text{} and italicize it to achieve this?
    – Parth
    Nov 4, 2018 at 2:43
  • 1
    Why not perfect?
    – Sigur
    Nov 4, 2018 at 2:53
  • 2
    I would possibly use \mathit rather than \textit but never use the default math italic font for multi-letter identifiers, it is explictly designed with wide sidebearings so adjacent letters do not look like part of a ward but as a product of variables. Nov 4, 2018 at 10:42
  • 1
    @Mico yes that's why I said "perhaps" rather than "do":-) it is the usual issue \mathit is set up for the math font setup as a fixed math alphabet font. \textit is the current text italic font (so for example would be bold italic if the text font outside the math was bold) and it might be a completely different font set, by default they are both computer modern italic but math and texts fonts are separately specified and do not have to be the same. Nov 4, 2018 at 11:04

3 Answers 3

3

I propose this format (with \bigl( \bigr) if you wish):

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\begin{aligned}
\textit{democ}_{i,t} &= 
\alpha\, (\textit{democ}_{i,t-5}) + \beta\, (\textit{students abroad}_{i,t-5}) \\ 
&\quad  + \gamma\, (\textit{democ. in receiving countries}_{i,t-5}) \\ 
&\quad  + \delta\, (\textit{students abroad}_{i,t- 5}) (\textit{democ. in receiving countries}_{i,t-5}) \\ 
&\quad  + \textit{country fixed effects}_i +  \textit{time fixed effects}_t + \epsilon_{i,t}
\end{aligned}
\end{equation}
\end{document}
0
7

Inspired by Mico's solution, here's an improved one that

  1. Doesn't need \,
  2. Automatically adds parentheses if the variable consists of several words
  3. Uses \mathit instead of \textit
  4. Doesn't need “backslash space” after a period

Here's the code

\documentclass{article}
\usepackage{amsmath}
\usepackage{xparse}

\ExplSyntaxOn
\NewDocumentCommand{\vn}{m}
 {
   \seq_set_split:Nnn \l_tmpa_seq { ~ } { #1 }
   \int_compare:nTF { \seq_count:N \l_tmpa_seq > 1 }
    {
     \seq_set_map:NNn \l_tmpb_seq \l_tmpa_seq { \exp_not:N \mathit { ##1 } }
     (\seq_use:Nn \l_tmpb_seq { \  })
    }
    { \mathop{}\!\mathit{#1} }
 }
\ExplSyntaxOff

\begin{document}

\begin{equation}
\begin{split}
\vn{democ}_{i,t} ={}
& \alpha \vn{democ}_{i,t-5} + \beta \vn{students abroad}_{i,t-5} \\
& +\gamma \vn{democ. in receiving countries}_{i,t-5} \\
& +\delta \vn{students abroad}_{i,t-5} \vn{democ. in receiving countries}_{i,t-5} \\ 
& +\vn{country fixed effects}_i + \vn{time fixed effects}_t + \epsilon_{i,t}
\end{split}
\end{equation}

\end{document}

enter image description here

6

Here's an answer that's quite similar, at first glance, to @Sigur's answer. It differs from Sigur's by (a) providing adjustments to make sure that the . ("dot", "period", "full stop") isn't misinterpreted as a sentence-ending punctuation mark, (b) placing the parentheses solely around the variable names, not their subscript terms, (c) providing for explicit italic corrections and, most importantly, (d) taking a more "LaTeX-y" approach to things, by which I mean separating meaning from form, by defining a macro called \vn (short for "variable name") that's to be used to display variable names. In the code below, I've chosen the definition \newcommand\vn[1]{\textit{#1}}. An advantage of such a setup is that if you ever, at some point in the future, decide that you'd rather display variable names using an upright rather than an italic font, all you'd need to do is change the definition of \vn. In particular, you would not have to go and check each and every instance of \textit in the document and decide whether it needs to be changed to \textrm.

The following code also makes some spacing adjustments between \vn{democ} and its associated subscript terms.

enter image description here

\documentclass{article}
\usepackage{amsmath}
\newcommand\vn[1]{\textit{#1\/}} % to display a variable name
    %% note the italic correction provided by "\/"
\begin{document}

\begin{equation}
\begin{split}
\vn{democ}_{\mkern1.5mu i,t} &= 
\alpha\, \vn{democ}_{\mkern1.5mu i,t-5} + \beta\, (\vn{students abroad})_{i,t-5} \\ 
&\quad +\gamma\, (\vn{democ.\ in receiving countries})_{i,t-5} \\ 
&\quad +\delta\, (\vn{students abroad})_{i,t-5}\, (\vn{democ.\ in receiving countries})_{i,t-5} \\ 
&\quad +(\vn{country fixed effects})_i + (\vn{time fixed effects})_t + \epsilon_{i,t}
\end{split}
\end{equation}
\end{document}
2
  • I think in latex italic correction is included by default. Are you sure you need \/? May be I'm wrong.
    – Manuel
    Nov 4, 2018 at 11:14
  • 1
    @Manuel - If one stays entirely within text mode, as in ... \textit{word} ..., then the italics correction would indeed be performed automatically at the end of the argument of \textit. For the example at hand, though, that's not the case: math stuff (specifically, a closing parenthesis) follows the text-italic material. Do check for yourself the output of (\vn{students abroad}) -- specifically, the distance between d and ) -- if the macro is set up with and without the italic correction.
    – Mico
    Nov 4, 2018 at 14:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .