Fonts & Character Sets\L in math mode?

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
Post Reply
rvandegrift
Posts: 4
Joined: Sat Nov 20, 2010 9:45 pm

\L in math mode?

Post by rvandegrift »

Hi everyone,

Is there any way to get an L with stroke (\L) in math mode? I've been using \mbox to date, but this causes botched formatting in some contexts (superscripts and subscripts are my particular pain points).

Thanks!
Last edited by rvandegrift on Tue Nov 23, 2010 3:38 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

\L in math mode?

Post by frabjous »

I can use \L in math mode without the need for \mbox{...}, or \text{...} or anything similar.

Depending on your encoding you might also be able to use the character Ł directly. (E.g., with unicode/utf encoding and loading \usepackage[utf8]{inputenc}, I can use it.)

If you're having trouble getting it work right in a particular context, it would be helpful to see a minimal working example showing the problem.
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

\L in math mode?

Post by localghost »

This is very strange. I can confirm the problem. In fact with MiKTeX 2.8 and TeX Live 2010. Input encoding and file encoding correspond. The log file (from TeX Live) is attached. Haven't yet tested with other fonts.

Code: Select all

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

\begin{document}
  \L
  \[
    \L
  \]

  Ł
  \[
    Ł
  \]
\end{document}
The curious thing about the log is that it contains characters which don't belong to the encoding. I will check the MiKTeX log as soon as possible.


Thorsten
Attachments
mathmodeL.log
(13.12 KiB) Downloaded 260 times
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
rvandegrift
Posts: 4
Joined: Sat Nov 20, 2010 9:45 pm

\L in math mode?

Post by rvandegrift »

A simple minimal example. This fails on Tex Live 2009

Code: Select all

\documentclass{article}
\begin{document}
$\L$
\end{document}
I get the same error: "LaTeX Warning: Command \L invalid in math mode on input line 3." Log file is attached.

Ross
Attachments
luk-test.log
(2.15 KiB) Downloaded 288 times
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: \L in math mode?

Post by frabjous »

Works just fine for me on TeXlive 2010.

I'm attaching my log and the output. (I added \listfiles to the beginning of the code to get a file list, but it's so minimal I doubt it will be useful.)
Attachments
scratch.log
(3.49 KiB) Downloaded 267 times
scratch.pdf
(8.32 KiB) Downloaded 399 times
rvandegrift
Posts: 4
Joined: Sat Nov 20, 2010 9:45 pm

\L in math mode?

Post by rvandegrift »

No - it's not working for you either :) Check your log: "LaTeX Warning: Command \L invalid in math mode on input line 4."

Looks LaTeX kicks out the L with stroke as a non-math mode character. To see the difference, check out this:

Code: Select all

$x_L x_\L
The two subscripts should come out the same size.

Ross
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

\L in math mode?

Post by frabjous »

Ah, thanks, that's a good example.

This makes them the same size:

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\begin{document}

$x_{L} x_{\text{\L}}$
\end{document}
Change \text to \textit if you want it in italics.
rvandegrift
Posts: 4
Joined: Sat Nov 20, 2010 9:45 pm

Re: \L in math mode?

Post by rvandegrift »

Aha, that seems to do the trick - sizing is correct for the few variations I just checked. Definite improvement on what I was doing before. Thanks!
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

\L in math mode?

Post by localghost »

Now that the problem is obviously solved, please be so kind and mark the topic (not the last post) accordingly as clearly written in the Board Rules (to be read before posting). Please keep that in mind for the future so that further reminders will not be necessary.
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
Post Reply