LaTeX users online
In total there are 6 users online :: 0 registered, 0 hidden and 6 guests (based on users active over the past 5 minutes)Most users ever online was 1327 on Tue Nov 05, 2013 7:11 pm
Users browsing this forum: No registered users and 6 guests
LaTeX blog world
TUG 2016 in Toronto - Arriving and first excursion (Stefan)Define new macros for logical markup (Tobi)
Finding typefaces (fonts) (Tobi)
Order of float placement parameters (Tobi)
Changes and News (Clemens)
What's new in chemmacros v5.6? (Clemens)
Lass Dich nicht von einem Hobby stressen! (Markus)
Das "Currentfile" Paket (Uwe)
TeX Live 2016 released (Stefan)
How to Deal with Wide Tables (Lian Tze Lim)
Get TeX Live 2016 now (Tobi)
LyX 2.2 released (Stefan)
Point vs. Big Point (Tobi)
Event tip: TeX Users Group meeting 2016 Toronto (Stefan)
Programming network switches and routers using TeX (Stefan)
Removing italics/ensuring not italic/theorem environmentLaTeX Forum: Text FormattingAdd tags
4 posts
• Page 1 of 1
I'm trying to replace the built-in \bmod operator (which, rather unhelpfully, just types the word "mod") with a proper modulo operator: %. I'm currently using \texttt{\%}. It's not ideal (an ideal modulo operator should really be almost square, but the font used by \texttt has a very narrow and tall percent sign), but it's a lot better than the default cursive-style percent sign in latex.
The replacement works well enough in normal environments, but if I place it inside the theorem environment, it becomes italicized, which is wrong. Any suggestions would be appreciated, ideally I'd like to use something like \ensureNotItalic{\texttt{\%}}}, but I don't know how to implement something like \ensureNotItalic. (I'd also like to improve on the font, if anyone has suggestions for that, but getting rid of the italicization is essential.) Here's a MWE: \documentclass{article} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsmath} \usepackage{amsthm} \newtheorem*{lem}{Lemma} \let\bmod\undefined \DeclareMathOperator{\bmod}{\texttt{\%}} \begin{document} The command \verb+\bmod+ (in math mode) should look like $\bmod$, but in the text of a theorem environment, it comes out italicized... \begin{lem} The extent of $\sigma_{axx}$, where $a$ and $x$ are integers, is $2x + a\bmod2$ \end{lem} \end{document} Last edited by verbatim on Sun Dec 19th, 2010, edited 1 time in total.
The argument to \DeclareMathOperator is normally put in an upright font (witness the effects of \sin or \cos, etc.), so in this case, it should work to put simply:
Or if you want to be more explicit:
\textup is the explicit command for "upright" (non-italic) text. (\textup is the counterpart to \textit ; \upshape is the counterpart to \itshape, etc.) Or combine the effects:
That's exactly what I did, see the MWE.
Well, except that I switch to \texttt inside it in order to get a more appropriate looking operator. The default % sign doesn't look the least bit like a modulo operator. edit: Posted at about the same time as the (edit to the) post above, sorry for any confusion. Thanks, \textup does the trick. Now, if I could only find a way to use a font that actually has an appropriately shaped % sign to use as a modulo operator... Last edited by verbatim on Sun Dec 19th, 2010, edited 3 times in total.
4 posts
• Page 1 of 1
LaTeX users onlineUsers browsing this forum: No registered users and 6 guests |