2

I am using $ signs yto italicize some text in my paper.

\documentclass[conference]{IEEEtran}

\begin{document}

Hence, even though both 1-$doPly$ and 2-$doPly$ declare to call the interface 
$getAttackedPostion$ of class $EnPassantPly$ 
($((EnPassantPly)ply).getAttackedPosition()$), they actually do call its 
implementation in class $EnPassantPlyImpl$.

\end{document}

The problem that I have is that this results into pretty big spaces in my pdf document as shown in the picture, how to avoid such big spaces and have small spaces instead? enter image description here

2
  • 3
    This is code, not math, so you should be using either \textit{...} or a package that supports code, such as listings and its \listinline (with a breaklines=true). The large spaces result from lack of positions to break the lines May 3, 2019 at 7:19
  • A note for future questions: Please make your code examples working and minimal. This means they should start with \documentclass, end with \end{document} and not contain any packages or code that is not necessary to illustrate your problem. (See my edit of your question.) Also, the image your provide (which is good) should show the output of your MWE, not a different output that also illustrates the problem.
    – schtandard
    May 3, 2019 at 8:06

1 Answer 1

6

Don't do that! Use \textit or \itshape (or even better, write your own macro with a semantically meaningful name that expands to \textit or \itshape) for italic text. This will also get rid of your spacing issue.

As was rightly pointed out to me in the comments, the parentheses should still be upright. The embrac package can help with that. Depending on the font, you will have to find the right kerning first (see the documentation for pointers). For the font in your MWE, no extra kerning works well.

I constrained the effect of embrac to \mymacro here, which may not necessarily be what you want.

\documentclass[conference]{IEEEtran}

\usepackage{embrac}
\RenewEmph{(}{)}
\EmbracOff

\newcommand*\mymacro[1]{{\EmbracOn\textit{#1}}}

\begin{document}

Hence, even though both 1-\mymacro{doPly} and 2-\mymacro{doPly} declare to call the interface \mymacro{getAttackedPostion} of class \mymacro{EnPassantPly} (\mymacro{((EnPassantPly)ply).getAttackedPosition()}), they actually do call its implementation in class \mymacro{EnPassantPlyImpl}.

\end{document}

MWE output

(Obviously, you should give \mymacro a different name that reflects its meaning.)

4
  • The parentheses should not be italics.
    – egreg
    May 3, 2019 at 8:32
  • @egreg: Hmm, that's true. Do you know of any simple way to achieve that?
    – schtandard
    May 3, 2019 at 9:26
  • The embrac package is dedicated to this problem.
    – Bernard
    May 3, 2019 at 11:20
  • @Bernard: Thanks for the pointer.
    – schtandard
    May 3, 2019 at 16:52

You must log in to answer this question.

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