3

Currently, I am writing an academic paper in latex and facing some issues. It might be due my lack of expertise in Latex or ignorance of some tricks or tweaks. Currently there are two issues i am facing.

  1. no space among words

I have written the following line of code

\begin{displaymath}
   TPR = \frac{\# lines selected from GSL in C}{\# lines in GSL in C}
\end{displaymath}

and it appears like this

enter image description here

  1. line spacing among paragraphs

Other issue i am facing is about line spacing. I have pressed an enter key at the end of each paragraph to start a new one. Also, i have tried the \ and \par commands to tackle this issue but it remains the same.

What I am looking for is start of paragraph like this

enter image description here

but it appears like this

enter image description here

Any solution for both issues

By default i have used a blank like between each paragraph. Here is an example - screenshot from my Texmaker. enter image description here

4
  • Could we see the code that produces that produces that blank line? – Bernard Jun 27 '14 at 7:40
  • For paragraph breaks just use a blank line in the source. The format you say you want is the default format, the format you show is easily obtainable in many ways, so the answer is don't do whatever you did to specify a non zero parskip, but as you have provided no example document hard to give specific advice. – David Carlisle Jun 27 '14 at 8:49
  • @ David Carlisle and @Bernard I have editted my question with more details. Awaiting a reply. – Skipper07 Jun 27 '14 at 9:09
  • @Skipper07: The code you show is perfectly normal, but it doesn't correspond to what happens in the last image of your initial post (not the same text. Could you give a Minimal Working Example that compiles? – Bernard Jun 27 '14 at 10:23
1

Here's a possibility. For the text fractions, one could use stacks. I show it here with the wide element in both the numerator and alternately denominator. EDITED to preserve math axis.

For the paragraph issue, the relevant measures are \parskip and \parindent. I show paragraphs with two different settings, one of which is what you hopefully want, and the other what you do not want.

\documentclass[10pt]{article}
\usepackage{stackengine,lipsum}
\def\Overline#1{\def\stacktype{S}\setbox0=\hbox{#1}\stackon[1.5pt]{#1}{\rule{\wd0}{0.4pt}}}
\def\stacktype{L}
\begin{document}
\[
  TPR = \stackanchor{\underline{\# lines selected from GSL in C}}
    {\# lines in GSL in C}
\]
\[
  TPR = \stackanchor{\# lines in GSL in C}
    {\Overline{\# lines selected from GSL in C}}
\]

\parskip0pt\parindent3ex
\lipsum[3-4]
\parskip\baselineskip\parindent0pt
\lipsum[3-4]
\end{document}

enter image description here

4
  • If we add a '\section' tag before it the indentation disturbs. In acm_proc_article-sp template the first line under the heading overlaps with a heading i.e it displays over the section heading. Alas! i can't upload an image in a comment. I hope you understand what the issue is. – Skipper07 Jun 29 '14 at 10:29
  • @Skipper07. I'm not sure I fully understand the issue, but I'll say this: In general, since \parskip and \parindent would be fixed over the whole document, it would be appropriate to set those values in your document preamble. In my MWE, I changed them in the course of the document itself just to demonstrate the two different results in a single document. So my first suggestion is to place those commands in your preamble. – Steven B. Segletes Jun 30 '14 at 10:03
  • How to make above said equations into italics using your suggestion? Generally the equation in 'frac{}' is displayed in italics and thats what i am exactly looking for a display. – Skipper07 Jul 22 '14 at 18:30
  • @Skipper07 You can enclose the stacking arguments in a \textit{}. For example: TPR = \stackanchor{\textit{\# lines in GSL in C}}{\Overline{\textit{\# lines selected from GSL in C}}} – Steven B. Segletes Jul 22 '14 at 18:49
1

As far as the your first issue is concerned what you need is the \mbox construct.

\frac{\mbox{I am the numerator}}{\mbox{I am the denominator}}

As regards your second issue just use a newline by appending this \\ at the end of the paragraph. This gives you an one line space between consecutive paragraphs (assuming this is what you want). In case you don't want the one line space a simple line gap in the source text should serve the purpose.

2
  • How to italicize it? using your approach makes the formula in a normal display but not in italics – Skipper07 Jul 22 '14 at 19:00
  • @Skipper07 : The \mbox construct behaves like a normal text environment. So, you can use the standard text formatting options inside it. For, example using \it will italicize the text inside the scope of \mbox. – theOne Jul 30 '14 at 5:35
1

I'll answer to the first problem, since there are too few clues for the second one; besides it's better to have a single problem per question.

The “correct” way to deal with those “textual fractions” is

\[
\textrm{TPR} = 
\frac{\textrm{\# lines selected from GSL in C}}{\textrm{\# lines in GSL in C}}
\]

Possibly you could use \textit{TPR} if italics are always used for this. You probably don't mean the product of the three quantities T, P and R, but a single variable called TPR.

enter image description here

0

about the first one, add \usepackage{mathtools} to the preamble

Then try this one , It will treat the text as normal text and it will not be italicized like other math symbols

\begin{displaymath}
     TPR = \frac{\# \text{lines selected from GSL in C}}{\# \text{lines in GSL in C}}
\end{displaymath}

or this, It inserts \ before each space character to consider as normal space character. This will keep your text italicized.

\begin{displaymath}
     TPR = \frac{\#lines\ selected\ from\ GSL\ in\ C}{\# lines\ in\ GSL\ in\ C}
\end{displaymath}

I am not so sure about the error in the second question . Have you tried using just \\ to insert a new line. Like this

random text now paragraph is to be broken .\\ this text will come in a new line
5
  • (1) not mush to do with mathtools, \text comes from amstext which is auto loaded by amsmth. (2) Never EVER use `\` in the text! EVER. Since the OP does not provide a minimal example, we can only guess that the extra spacing is either a configuration issue, or stretch on the page. – daleif Jun 27 '14 at 9:38
  • I have not used '\' in the text but it is in math mode. But even if that is wrong then can you tell me why ? – Nishant Jun 27 '14 at 9:51
  • Annoying system, should state ` \\ ` in the text, Your last example. You never have the need to make forced line breaks in the text. (hmm, apparently the formatting is a bit broken, it is the double blackslash or \newline) – daleif Jun 27 '14 at 9:58
  • @daleif You should use double back quotes around the double backslash here in comments: \\ – egreg Jun 27 '14 at 21:18
  • @egreg, thank been annoyed by that one for a while – daleif Jun 28 '14 at 6:06

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.