1

I have this line in my code:

\fbox{\ker(r \lambda)_* \cong\mathbb{Z}/p^{a+t-\min\{a,b\}}}

And this is my document from the beginning

 \documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage[T1]{fontenc} \usepackage{lmodern} % Sprache (neue deutsche Rechtschreibung) \usepackage[ngerman]{babel} % Mathematik \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{tikz-cd}

\usepackage{mathtools} \usepackage{commath} \usepackage{bbm} \usetikzlibrary{babel} \usetikzlibrary{shapes.geometric}

\usepackage[margin= 1 in]{geometry}

%\addtolength{\oddsidemargin}{-.875in} \addtolength{\evensidemargin}{-.575in} %\addtolength{\textwidth}{1.75in}

\addtolength{\topmargin}{-.275in}
\addtolength{\textheight}{- .1 in}

\title{Master Thesis} \author{Jacob } \date{Feb 21}

\begin{document}

but the line I mentioned is not compiling, could anyone tell me why my code is not working please?

Mico
  • 506,678
Happy
  • 363
  • 1
    The code and sourcecode tags are meant to be used for problems in typesetting source code, not in your document. Moreover, I bet this problem is not restricted to overleaf. – jarnosc Jul 04 '21 at 15:33
  • 1
    Did you look at the error message, viz., "Missing $ inserted". This message might have tipped you off that TeX wasn't in math mode when some math-y material was encountered in the argument of \fbox. – Mico Jul 04 '21 at 15:51

1 Answers1

2

The contents of \fbox ("frame box") are processed in text mode by default. Since the argument of your \fbox directive is math-y stuff, you need to inform LaTeX to switch to math mode. You can do this by replacing

\fbox{\ker(r \lambda)_* \cong\mathbb{Z}/p^{a+t-\min\{a,b\}}}

with

\fbox{$\ker(r \lambda)_* \cong\mathbb{Z}/p^{a+t-\min\{a,b\}}$}

Alternatively, if the passage in question occurs while already in math mode (say, while inside a displayed equation), you might use \boxed. E.g.,

$ \boxed{\ker(r \lambda)_* \cong\mathbb{Z}/p^{a+t-\min\{a,b\}}} $

The macro \boxed is provided by the amsmath package.


enter image description here

\documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}
\fbox{$\ker(r \lambda)_* \cong\mathbb{Z}/p^{a+t-\min\{a,b\}}$}

$\boxed{\ker(r \lambda)_* \cong\mathbb{Z}/p^{a+t-\min{a,b}}}$ \end{document}

Mico
  • 506,678
  • To be precise I was writing this line as $$\fbox{\ker(r \lambda)_* \cong\mathbb{Z}/p^{a+t-\min{a,b}}}$$ but it did not compile. – Happy Jul 04 '21 at 16:14
  • @Happy - For the \fbox solution to work with its math-y argument, it doesn't matter that \fbox{...} occurred inside a displayed equation. But since you've confirmed that the expression occur within a displayed equation, I would use the \boxed approach, not the \fbox approach. – Mico Jul 04 '21 at 16:52