2

whenever i have a fraction inside a square root, the square root symbol drops down below the line and intercepts whatever is on the next line. I think the package savetrees may be causing the problem.

MWE

\[
  \begin{array}{ll}
    \sqrt{\frac{1}{x}}  &  \\
    intercepted text    &   \\ 
  \end{array}
\]

Figure 1

these are the warnings i get

Typesetting problem in main.tex (line 36): Underfull \hbox (badness 10000) in paragraph at lines 36--41
Typesetting problem in main.tex (line 55): Overfull \hbox (16.36372pt too wide) in paragraph at lines 55--68
Typesetting problem in main.tex (line 53): Overfull \hbox (5.0pt too wide) in paragraph at lines 53--69
Typesetting problem in main.tex (line 87): Overfull \hbox (77.67256pt too wide) in paragraph at lines 87--97
Typesetting problem in main.tex: Overfull \vbox (27.9158pt too high) has occurred while \output is active []

closed as unclear what you're asking by egreg, Jesse, Andrew Swann, lockstep, Bernard Jun 22 '14 at 10:32

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    You can control the vertical space using \\[1em] for example. Also you don't need to break the line for the last line. – Sigur Apr 23 '14 at 1:06
  • 1
    Welcome to TeX.SE. It would be helpful if you composed a fully compilable MWE including \documentclass and the appropriate packages that reproduces the problem, especially since I don't see the problem you are reporting when I make a complete document. Hence there must be some other package/setting that is causing this problem. – Peter Grill Apr 23 '14 at 1:19
  • 1
    Thanks for posting a screen shot. Unfortunately, the code snippet you've provided does not, by itself, give rise to the very deep bottom of the square root sign. Please post a full MWE that generates the problem illustrated in the screen shot. – Mico Apr 23 '14 at 1:31
  • 1
    @user50375 Unfortunately, savetrees by itself is not the problem (I just did a test and couldn't reproduce the odd behaviour). As others have suggested, we'll need a MWE. – Gonzalo Medina Apr 23 '14 at 1:40
  • 3
    Also a math mode problem, because intercepted text is set in text, not math mode. Are there any errors compiling the document? – Heiko Oberdiek Apr 23 '14 at 1:40
3

When inside an array environment, LaTeX is in so-called inline-math mode, meaning (among other things) that the vertical space between lines is deliberately kept to a minimum. (Incidentally, I cannot replicate the look of the screen shot you've provided based solely on the code snippet you've provided. When I expand the code snippet into a reasonably minimalist compilable LaTeX document, the bottom of the square root symbol does not literally intersect the material in the next line: TeX adds some emergency vertical space to keep this from happening. Have you -- or a package loaded in the preamble -- fiddled with the parameters that govern the insertion of emergency vertical stretch?)

To lessen the appearance of such a (near-)intersection, you could manually add a bit of vertical space to the row that contains the term \sqrt{\frac{1}{x}}. Or, to incorporate the fact that LaTeX is in inline-math mode while inside an array, you could choose to switch to "inline fraction look", i.e., write \sqrt{1/x} instead of \sqrt{\frac{1}{x}}. If the amsmath package is loaded, you could compact the expression further by writing \sqrt{\smash[b]{1/x}}; the [b] part tells TeX not consider any material that drops below the baseline when deciding how low the bottom part of the square root sign should be set.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for \text and \smash[b] macros
\begin{document}
\[
\begin{array}{lll}
 \sqrt{\frac{1}{x}} & \sqrt{1/x} & \sqrt{\smash[b]{1/x}} \\
 \text{Almost intersects}  &\text{Doesn't intersect} &   \text{Doesn't intersect} \\ 
\end{array}
\]
\end{document}
  • +1 for \smash[b]{1/x}. I never knew \smash had an optional argument. – Casimir Feb 14 '17 at 15:35
  • @Casimir - It's the amsmath package that provides this extension/refinement of the TeX \smash macro. – Mico Feb 14 '17 at 15:39
2

I propose a solution based on cellspace that lets you define a minimal vertical spacing between the top of a row and the bottom of the above row, and symmetrically between the bottom of a row and the top of the row below. All you have to do then for tabulars is to prefix the qualifier for the columns with the letter S (or C if you load siunitx).

For math, it's a little more complicated: first you have choose the math option; and for each column you have to ask enter mathmode. For some reason, the S qualifier makes leave math mode. So I define a new column type to save some typing. The code that follows illustrates this.

Note that solutions based on increasing the value of \arraystretch results in row contents that is not vertically centred.

\documentclass[10pt]{article}

\usepackage[utf8]{inputenc}
\usepackage{amsmath, array}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage[math]{cellspace}
\setlength{\cellspacetoplimit}{4pt}
\setlength{\cellspacebottomlimit}{4pt}
\newcolumntype{M}{ >{$}Sl <{$}}

\begin{document}

\[ \begin{array}{ll}
\hline
\sqrt{\dfrac{1}{x}}  &  \\
\hline\addlinespace
\text{intercepted text}    &  \\
\hline
\end{array}
\qquad
\begin{array}{ MM}
 \hline
\sqrt{\dfrac{1}{x}}  &  \\
\hline
\text{intercepted text}    &  \\
\hline
 \end{array} \] 
\end{document}

enter image description here

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