Closed goyalyashpal closed 1 year ago
but some curious details:
[DONE} \RequirePackage[gray]{xcolor}
or \usepackage[gray]{xcolor}
was setting that.
~~Overleaf tutorial: Code Highlighting with minted shows the output as colored,
whereas the output in my "document" is shown as grayscale too, so, it means smth is setting that~~
mention of "cooperation" between fancyvrn and listings package
Future versions of ‘fancyvrb’ and ‘listings’ packages are planned to cooperate, ... - fancyvrb-doc at I.7 Pretty Printing (page 23)
minted
only provides four font settings: fontfamily
, fontsize
, fontshape
, fontseries
. These simply pass options on to fancyvrb
internally; fancyvrb
actually does the code typesetting. fancyvrb
only provides built-in support for a few fonts, so you will have to configure it for what you want, which will partly depend on whether you are using pdfTeX, XeTeX, or LuaTeX. TeX.SE may be helpful.
There is no minted
equivalent of the listings
setting inputpath
.
There is no "cooperation" between fancyvrb
and listings
. There are some settings in common, and in some situations they can be used together. But they often have different settings and different approaches.
i am using pdflatex.
also, fancyvrb doesnt have any issue tracker/community post discussions where i can file suggestions to 'em right? like here, gitlab, s_forge, c_berg, s_hunt etc...
I had a suggestion regarding to its numberblanklines=false
option, its awesome, but the suggestion is to expand it to accept values equivalent to: "normalcount", "Dont count and displaydashes", "dont count display nothing"
or maybe to have two settings:
this countblanklines
will only affect when XN0R of its vale with value of numberblanklines
results in False i.e. when these both are NOT having same boolean value.
numberblanklines=false |
numberblanklines=true |
|
---|---|---|
countblanklines=false |
normal (current behaviour of numberblanklines=false ) |
show dashes - for blank lines [MY WANT] |
countblanklines=true |
just dont show the number for blank lines, but count them [USEFUL FOR COMPILER ERRORS] | normal (current behaviour for normalblanklines=true ) |
For something like Times Roman under pdfTeX, you can try this:
\usepackage{mathptmx}
\usepackage{minted}
\setminted{fontfamily=ptm}
If you want to customize things further, you'll probably need to go through the respective documentation or perhaps search https://tex.stackexchange.com/.
fancyvrb
doesn't have a git repo or issue tracker anywhere that I'm aware of.
so, font size to 12, and no formatting for anything (i.e. all black) except comments will still require going to fancyvrb?
Size: \documentclass[12pt]{article}
, \setminted{fontsize=\large}
, etc.
Color: \setminted{style=bw}
. If you really want gray comments, you'll have to customize the comment token macro. You'll need something like this in the preamble:
\makeatletter
\appto{\minted@patch@PYGZhy}{%
\def\PYG@tok@c{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.5,0.5,0.5}{##1}}}}
\makeatother
thanks for all the help. i had some thoughts related to this in direction of maybe some linking minted API with listings instead of fancyvrb...
but couldnt formalise it very well, so, wiill leave it at that
thabks again.
Just a small note, color mode gray
also works instead of rgb
- \def\PYG@tok@c{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.5,0.5,0.5}{##1}}}}
+ \def\PYG@tok@c{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[gray]{0.5}{##1}}}}
For some of these options in lstinputlisting
: linerange
, lastline
, consecutivenumbers
, firstnumber
i have seen existing options in either of minted or fancyvrb documentation, will post here someday later
\lstinputlisting[%
linerange={10-40,48-48,56-107},
% lastline=108,
% consecutivenumbers=false
]{Rational.h}
\lstinputlisting[%
firstnumber=last,
linerange={12},
% consecutivenumbers=true,
]{rational.cpp}
\setminted{fontfamily=ptm} - @ gpoore at https://github.com/gpoore/minted/issues/366#issuecomment-1522543607
with setminted
or fvset
using ptm
font; the characters like _
, <
, {
etc from the source code are not rendering properly.
LEFT: minted , RIGHT: listings
\usepackage[T1]{fontenc}
linerange
,lastline
,consecutivenumbers
,firstnumber
firstnumber
https://github.com/gpoore/minted/blob/13e25d05cd382cf55f66636e0b1a91d94c2b4e4c/source/minted.dtx#L1318-L1320
inputlanglinenos
https://github.com/gpoore/minted/blob/13e25d05cd382cf55f66636e0b1a91d94c2b4e4c/source/minted.dtx#L917-L918
Only linerange remains now
Summary
So, i needed some pointers for achieving the same results.
I looked at this issue as well 365 which mentions setting via fancyvrb package i guess, but couldn't figure out how to use that in \setminted{}
Details
The basic settings I need & couldn't find are:
font settings:
source location: to avoid typing complete relative location again and again
[DONE]
[MUST]breaklines
to soft wrap the long linesFollowing are my settings for the listings package:
LEFT: minted , RIGHT: listings
Versions
listings
: 1.9minted
: 2.7