8

This question already has an answer here:

I want to mention the name of an specific function (or method) that I used in a experiment in a normal paragraph in my dissertation. What is the best way to do it? Considering that the official dissertation format that my teachers gave me doesn't mention how to do it.

For example:

"... with the Java programming language we can use System.nanoTime ..."

marked as duplicate by Massimo Ortolano, Wrzlprmft, E.P., Nat, Buzz Feb 13 '18 at 3:03

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

15

Is this a question regarding the formatting?

In this case I would use a typewriter font. In LaTeX this is simple by using \texttt:

... with the Java programming language we can use \texttt{System.nanoTime} ...

This looks similar to

... with the Java programming language we can use System.nanoTime ...

In Microsoft Word, you could simply use some font, such as Courier New.

However, you should check with your supervisor if this is OK for him or her.

  • 1
    Yes, thanks for adding some info about the non-LaTeX scenario. – Renato Sanhueza Feb 12 '18 at 19:24
  • 3
    Or \lstinline, if you're using listings and have specific formatting set up for your functions. – JAB Feb 12 '18 at 20:28
  • Why \texttt rather than \verb (if not having the listings package included)? – leftaroundabout Feb 13 '18 at 0:15
  • @leftaroundabout There are some drawbacks related to \verb. tex.stackexchange.com/questions/2790/… I had quite a good experience with always using \texttt since it seems to be more reliable and versatile. Maybe this depends also on personal preferences. – J-Kun Feb 13 '18 at 0:20
  • @J-Kun on the contrary I'd say \verb is more reliable, in particular for anything source code related, since it never misinterprets symbols as LaTeX syntax. Particularly relevant to function/method names: it has no problem with underscores. Of course, the option to include LaTeX commands is why \texttt is more versatile indeed, but for source snippets that versatility is mostly a burden. – leftaroundabout Feb 13 '18 at 0:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.