3

I am writing a paper in Lyx with relative success, but whenever I add in a math equation with an integral sign, it compiles it into a totally different symbol (like an intersection/arch symbol with a plus in the middle!). Any idea what is causing this? It the same whether I directly type in the TeX code or click the buttons with the integral symbol.

%% LyX 2.0.7.1 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\setcounter{secnumdepth}{2}
\setcounter{tocdepth}{2}
\usepackage{mathrsfs}
\usepackage{amstext}
\usepackage{esint}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
%
% tocprelim option must be included to put the roman numeral pages in the
% table of contents
%
% The cornellheadings option will make headings completely consistent with
% guidelines.
%
% This sample lyx document is based on a sample latex document originally provided by Blake Jacquot, and
% fixed up by Andrew Myers.
%
%Some possible packages to include
\usepackage{pstricks}
\usepackage{graphics}
\usepackage{moreverb}
\usepackage{subfigure}
\usepackage{epsfig}
\usepackage{subfigure}
\usepackage{hangcaption}
\usepackage{txfonts}
\usepackage{palatino}
\usepackage{amsbsy} % for bold math (use \boldsymbol in math env.)

%if you're having problems with overfull boxes, you may need to increase
%the tolerance to 9999
\tolerance=9999

% commented this out from downloaded tmplate
%\bibliographystyle{IEEEbib}

\renewcommand{\caption}[1]{\singlespacing\hangcaption{#1}\normalspacing}
\renewcommand{\topfraction}{0.85}
\renewcommand{\textfraction}{0.1}
\renewcommand{\floatpagefraction}{0.75}

\title {Title}
\author {B}
% don't forget to change master/phd option under "document class"

% to fix cross-reference formats:
%\newrefformat{fig}{figure~\ref{#1}}
%\newrefformat{sub}{section~\ref{#1}}
%\newrefformat{sec}{section~\ref{#1}}
%\newrefformat{cha}{chapter~\ref{#1}}
%\newrefformat{eq}{equation~\ref{#1}}
%\newrefformat{tab}{table~\ref{#1}}

% this can be removed before the final version
%\usepackage{watermark}
%\usepackage{datetime}
%\watermark{DRAFT \jobname; generated  \today{} \currenttime}

%\usepackage[colorlinks=false,bookmarks=true,breaklinks=true,pdfborder=0 0 0]{hyperref}

\makeatother

\usepackage{babel}
\begin{document}
The integral length scale can be computed directly as $\text{\ensuremath{\mathscr{L}}}_{L}=\int a_{11,1}(r)\ dr$
(should be integral sign!) at every height. 
\end{document}
10
  • Welcome to TeX.SE. Please provide minimal working example (small complete document, which will show your problem). Otherwise we can only guessing what is a cause of your problem.
    – Zarko
    Commented Jul 16, 2016 at 19:51
  • from clicking buttons (Insert-->Math-->Inline formula) and then pressing the button that looks like an integral, followed by a(r)dr, it appears as this when i copy/paste: \int a(r)dr but on the screen, when it changes to appear like it will in final form, the integral sign changes itself into the intersection symbol, which i cannot display here. whereas if I do Insert-->TexCode, this is what I'm typing in: $\int a(r)dr$ Both of them, when compiled, result in a displayed intersection sign, with a(r)dr following. the integral sign does not display.
    – Blair
    Commented Jul 16, 2016 at 20:08
  • 2
    @Blair Create a MNE directly with Lyx, a .lyx file is a text file, you can edit it with Notepad (or similar) and cut and paste here or (better) you can export your LyX file as pdflatex ( File->Export->as LaTeX).
    – CarLaTeX
    Commented Jul 16, 2016 at 20:55
  • 2
    @Blair: edit your question and insert it there using the code format button {}.
    – ig0774
    Commented Jul 16, 2016 at 21:33
  • 2
    @Blair please put a complete working example .lyx file. Read here for more information: wiki.lyx.org/FAQ/MinimalExample
    – scottkosty
    Commented Jul 16, 2016 at 23:12

1 Answer 1

5

It makes absolutely no sense to load txfonts and then palatino. The former sets up a Times font for text and math, the latter is largely obsolete. This is the source of the problem.

Besides, the preamble is horrible.

  1. Loading pstricks without needing it should be avoided
  2. Instead of graphics, load graphicx that's more powerful
  3. subfigure has been obsolete for 15 years; for subfloats, the recommended package is subcaption

  4. epsfig has been deprecated for more than 20 years; it exists just for back compatibility with old documents

  5. hangcaption is a LaTeX2.09 package so very obsolete

  6. amstext should be amsmath; amsbsy is loaded automatically by amsmath

  7. Setting \tolerance=9999 is a sure recipe for bad typesetting

Finally,

\text{\ensuremath{\mathscr{L}}}

is a very complicated way for getting the same effect of

\mathscr{L}

and I hope it isn't the initiative of LyX to do it.

An interword space between the function and the differential is wrong:

$\mathscr{L}_{L}=\int a_{11,1}(r) \, dr$

is the correct input.


How can you solve the issue? If you want Palatino as text and math font, remove

\usepackage{esint}
\usepackage{txfonts}
\usepackage{palatino}

and type

\usepackage{newpxtext,newpxmath}

instead.

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{babel}

\usepackage{amsmath}
\usepackage{newpxtext,newpxmath}
\usepackage{mathrsfs}

%\usepackage[colorlinks=false,bookmarks=true,breaklinks=true,pdfborder=0 0 0]{hyperref}

\setcounter{secnumdepth}{2}
\setcounter{tocdepth}{2}

% commented this out from downloaded tmplate
%\bibliographystyle{IEEEbib}



\title {Title}
\author {B}


\begin{document}

The integral length scale can be computed directly as 
$\mathscr{L}_{L}=\int a_{11,1}(r) \, dr$
(should be integral sign!) at every height. 

\end{document}

enter image description here

4
  • thanks for the thorough review - super helpful - most of this was given to me so it is copy/pasted from many years back and it is very foreign to me. EPS's are indeed not working either, so I've been trying to get around it as well. Looks like removing the txfonts does the trick; I'm missing the other packages but can find them if I do need to replace them. Thanks so much!!!
    – Blair
    Commented Jul 18, 2016 at 3:24
  • Good advices regarding the packages which were added by hand in the user preamble. In addition, LyX is able to load the packages like subcaption and amsmath automatically so they need not be input by hand. Lastly, \text{\ensuremath{\mathscr{L}}} is obtained when the user inserts \mathscr{L} inside a \text, which indeed is really superfluous here. LyX is merely responsible for adding \ensuremath automatically.
    – G.M.
    Commented Jul 18, 2016 at 13:14
  • @G.M. It adds \ensuremath automatically? This is (add word at your choice). ;-)
    – egreg
    Commented Jul 18, 2016 at 13:16
  • @egreg The user asked for it ;)
    – G.M.
    Commented Jul 18, 2016 at 13:27

You must log in to answer this question.

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