0

I want to write inline bash code. I am using following solution: insert code keywords inline

The command for minted inline code is called \mintinline{language}{code}

I want to write mintinline line as \footnotesize in order to reduce space between characters. But when I do that its sharpness is gone compare to without using \footnotesize.

\documentclass[10pt,journal,compsoc]{IEEEtran}
\usepackage[table]{xcolor}
\usepackage{listings}
\usepackage{minted}
\usemintedstyle{vs}

\begin{document} Introduction\newline \setminted[bash]{fontsize=\footnotesize} \mintinline{bash}{ls /home/user} \setmintedinline{fontsize=\normalsize} \newline \mintinline{bash}{ls /home/user} \end{document}

enter image description here

Here second line's character is not bold as the first one.


Is it possible to keep boldness of characters while applying footnotesize in mintinline? or is there any solution to reduce character spaces while keeping characters original boldness?

alper
  • 1,389
  • I don't see any bold at all in your image. – frabjous Jun 21 '22 at 18:15
  • Also your sample code doesn't compile. \setminted and \lstset do not use the same options. – frabjous Jun 21 '22 at 18:17
  • @frabjous I updated my question with working code and removed \lstset; comparing normalsize and footnotesize of the mintinline. \footnotesize is applied its like less sharper – alper Jun 21 '22 at 18:29
  • 2
    They look identical to me in all ways except size. They're literally using the same font. If you make the first one bigger with \scalebox{1.2}{...} the output looks like this: imgur link. What am I missing? – frabjous Jun 21 '22 at 18:56
  • Maybe you are looking for a font with different optical sizes so the small variants have wider strokes in the characters proportionally and so have a thickness in the strokes more similar to larger sizes? There are commercial fonts like that, but the only free one I know of is Latin Modern, which is very similar to TeX's default Computer Modern and has a mono variant. \usepackage[T1]{fontenc}\usepackage{lmodern}? – frabjous Jun 21 '22 at 19:07
  • .. small variants have wider strokes [yes I wanted to have wider strokes in the smaller font] // Should I just add \usepackage[T1]{fontenc}\usepackage{lmodern} to beginning of the file? – alper Jun 21 '22 at 19:46
  • Yes, in the preamble where you load the other packages after \documentclass.., etc., yeah. – frabjous Jun 21 '22 at 19:53
  • Could it be applied only for a single line(like only for the mintinline) but not for the other sections in the paper? – alper Jun 21 '22 at 20:41
  • The version for smaller sizes will only be applied when the font size is, well, smaller, though I don't know the exact cut off offhand. Are you using other fonts that the package conflicts with, or do you have other smaller text elsewhere you don't want different optical size variants for? Probably it's possible to get it for just one small portion, but I'd have to dig to find out the exact commands needed. Someone else might know. – frabjous Jun 21 '22 at 21:15
  • Do you have other smaller text elsewhere you don't want different optical size variants for [Yes sir, I have some smaller text in some tikz figures as well defined like every node/.style = {font=\footnotesize}, they got affected too] – alper Jun 21 '22 at 22:22
  • I think if you put \renewcommand{\ttdefault}{lmtt} at the end of the preamble, it will only be applied to monotype fonts, which might fit your needs. If literally you only want it applied in that one spot, or only in certain minted listings, I think \setminted[bash]{fontsize=\footnotesize,fontfamily=lmtt} would do it, but you might need an extra { before \setminted, and an } after the \mintinline command to prevent it affecting later minted listings. – frabjous Jun 21 '22 at 22:46
  • \setminted[bash]{fontsize=\footnotesize,fontfamily=lmtt} did not print anything :( – alper Jun 21 '22 at 23:10
  • With the sample document posted above? Works for me. – frabjous Jun 21 '22 at 23:19
  • yes with the sample document posted above , I also put \renewcommand{\ttdefault}{lmtt} to top section but it does not write it into the pdf – alper Jun 21 '22 at 23:21
  • Can you post the log file, either here or at some pastebin site? – frabjous Jun 21 '22 at 23:26
  • Please see the log here: https://gist.github.com/avatar-lavventura/30ba4cb713c8bc385f0dd3a5ef5814b5 – alper Jun 22 '22 at 09:10

0 Answers0