# LaTeX Error: File knitting.sty' not found - cannot get knitting package to run

I am using LaTeX to typeset instructions for a knitting pattern that I designed. Additionally, I would like to include a knitting chart to visualize the motif. I found the knitting package on CTAN which looks very close to what I want to do. I followed the instructions in the package documentation in order to install it.

Like the documentation said, this is where I put the files:

• /usr/share/texmf/tex/latex/knitting/ (contains knitting.sty and uknit.fd)
• /usr/share/texmf/fonts/afm/knitting/ (contains .afm files)
• /usr/share/texmf/fonts/map/knitting/ (contains knitfont.map)
• /usr/share/texmf/fonts/source/knitting/ (contains .mf files)
• /usr/share/texmf/fonts/tfm/knitting/ (contains .tfm files)
• /usr/share/texmf/fonts/type1/knitting/ (contains .pfb files)

Then I tried to compile the sample file knitexamples.tex, but pdflatex tells me that it cannot find knitting.sty. However, if I manually enter the path to knitting.sty, pdflatex continues processing the .tex file, which I find very weird.

! LaTeX Error: File knitting.sty' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

Enter file name: /usr/share/texmf-texlive/tex/latex/knitting/knitting.sty


(The entire log file can be found at the end of my post.)

pdflatex then complains that

No file Uknit.fd. on input line 140.


(which I find even weirder because the file is called uknit.fd, not Uknit.fd., but maybe this is actually totally okay, I don't know).

To make sure LaTeX isn't looking for the files in the wrong place, I also placed copies of the above-mentioned folders into /usr/share/texmf-texlive/ and respective subfolders (where I usually deposit .sty and .cls files that I manually add to my TeX distribution, which so far has always worked out).
But the errors remain the same.

I then resorted to the last suggestion in the docs: dumping all files of the knitting package into the folder where I try to compile knitexamples.tex. This actually does compile the file without any errors and produces the desired .pdf file.

I would (perhaps understandably) prefer a different solution, but I am stumped as to how to do that.

This is the complete log file where said errors show.

This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian) (format=pdflatex 2012.4.27)  6 AUG 2012 12:04
entering extended mode
%&-line parsing enabled.
**knitexamples.tex
(./knitexamples.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, farsi, arabic, croatian, bulgarian, ukrainian, russian, czech, slov
ak, danish, dutch, finnish, french, basque, ngerman, german, german-x-2009-06-1
9, ngerman-x-2009-06-19, ibycus, monogreek, greek, ancientgreek, hungarian, san
skrit, italian, latin, latvian, lithuanian, mongolian2a, mongolian, bokmal, nyn
orsk, romanian, irish, coptic, serbian, turkish, welsh, esperanto, uppersorbian
, estonian, indonesian, interlingua, icelandic, kurmanji, slovenian, polish, po
rtuguese, spanish, galician, catalan, swedish, ukenglish, loaded.
(/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size10.clo
File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)

! LaTeX Error: File knitting.sty' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

Enter file name: /usr/share/texmf-texlive/tex/latex/knitting/knitting.sty
(/usr/share/texmf-texlive/tex/latex/knitting/knitting.sty
Package: knitting 2010/08/29

(/usr/share/texmf-texlive/tex/latex/graphics/color.sty
Package: color 2005/11/14 v1.0j Standard LaTeX Color (DPC)

(/etc/texmf/tex/latex/config/color.cfg
File: color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
)
Package color Info: Driver file: pdftex.def on input line 130.

(/usr/share/texmf-texlive/tex/latex/pdftex-def/pdftex.def
File: pdftex.def 2009/08/25 v0.04m Graphics/color for pdfTeX
))
\leftgap@knit=\skip43
\bgshift@knit=\skip44
\chartwidth@knit=\skip45
\stitchcountwidth@knit=\skip46
\rnleftwd@knit=\skip47
\rnrightwd@knit=\skip48
\bgbox@knit=\box26
\fgbox@knit=\box27
\ggbox@knit=\box28
\c@rownumber=\count88
\c@tempcount@knit=\count89
\c@rownumberskip=\count90
\c@stitchcountin=\count91
\c@stitchcountinprev=\count92
\c@stitchcountout=\count93
LaTeX Font Info:    Try loading font information for U+knit on input line 140.
LaTeX Font Info:    No file Uknit.fd. on input line 140.

LaTeX Font Warning: Font shape U/knit/g/n' undefined
(Font)              using U/cmr/m/n' instead on input line 140.

) (/usr/share/texmf-texlive/tex/latex/tools/calc.sty
Package: calc 2007/08/22 v4.3 Infix arithmetic (KKT,FJ)
\calc@Acount=\count94
\calc@Bcount=\count95
\calc@Bdimen=\dimen104
\calc@Bskip=\skip50
LaTeX Info: Redefining \setlength on input line 76.
LaTeX Info: Redefining \addtolength on input line 77.
\calc@Ccount=\count96
\calc@Cskip=\skip51
){/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}

pdfTeX warning: pdflatex (file knitfont.map): cannot open font map file
No file knitexamples.aux.
\openout1 = knitexamples.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 42.
LaTeX Font Info:    ... okay on input line 42.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 42.
LaTeX Font Info:    ... okay on input line 42.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 42.
LaTeX Font Info:    ... okay on input line 42.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 42.
LaTeX Font Info:    ... okay on input line 42.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 42.
LaTeX Font Info:    ... okay on input line 42.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 42.
LaTeX Font Info:    ... okay on input line 42.
(/usr/share/texmf/tex/context/base/supp-pdf.mkii
\scratchcounter=\count97
\scratchdimen=\dimen105
\scratchbox=\box29
\nofMPsegments=\count98
\nofMParguments=\count99
\everyMPshowfont=\toks14
\MPscratchCnt=\count100
\MPscratchDim=\dimen106
\MPnumerator=\count101
\everyMPtoPDFconversion=\toks15
)
LaTeX Font Info:    External font cmex10' loaded for size
(Font)              <7> on input line 48.
LaTeX Font Info:    External font cmex10' loaded for size
(Font)              <5> on input line 48.

LaTeX Font Warning: Font shape U/knit/g/p' undefined
(Font)              using U/knit/g/n' instead on input line 48.

LaTeX Font Warning: Font shape U/knit/g/g' undefined
(Font)              using U/knit/g/n' instead on input line 48.

Overfull \hbox (3.05557pt too wide) in paragraph at lines 51--60
[] |
[]

[1

]
! Font \U/knit/g/g/10 has only 7 fontdimen parameters.

l.82 }

?
! Emergency stop.

l.82 }

End of file on the terminal!

Here is how much of TeX's memory you used:
1022 strings out of 493857
12999 string characters out of 1153305
64769 words of memory out of 3000000
4358 multiletter control sequences out of 15000+50000
3640 words of font info for 14 fonts, out of 3000000 for 9000
714 hyphenation exceptions out of 8191
24i,9n,21p,218b,173s stack positions out of 5000i,500n,10000p,200000b,50000s
!  ==> Fatal error occurred, no output PDF file produced!

-
Since you've installed the files in the main repository, you will need to run texhash (or mktexlsr) to update its database of where files are. This looks to me as though you haven't done this step. –  Loop Space Aug 6 '12 at 13:16
Take a look at the answers to tex.stackexchange.com/q/48292/86 for a little more detail on texhash. –  Loop Space Aug 6 '12 at 13:18
@Andrew: Thank you for your reply. The knitting package doc says, "Any time you add supporting files to a local MiKTeX root, you have to refresh the file name database", but I wasn't sure whether this was a necessary step to take for me because I'm on Tex Live (besides not knowing how to do that). But why, then, did I never experience this kind of problem before? Is it no problem for TeX Live if I manually add just one single .sty file, but if it's new fonts or something like that it becomes necessary to run texhash for LaTeX to work properly? –  Anju Fabulina Aug 6 '12 at 13:33
I'm afraid that I don't know enough about TL to know when one has to run texhash. I know that if you install something in your home ~/texmf tree then it isn't needed and if you install it via the texlive manager tlmgr or another package manager then it probably runs this for you automatically –  Loop Space Aug 6 '12 at 13:49
Not sure. I could give an answer with "use texhash" I suppose! (I left it as a comment as I wasn't sure that that was the solution but it was the first thing to try.) We might already have a similar question in which we might close this as a duplicate to avoid having information scattered around the site. I'll ask in chat what people think is best. –  Loop Space Aug 6 '12 at 14:02

You have to perform two steps:

sudo mktexlsr
sudo updmap-sys --enable Map knitfont


The second step is necessary in order to be able to use the Type1 font; without it the TeX programs would create and use the bitmap version.

-
Thank you, I did it the way you suggested. Is it correct that the second step eliminates the need to call \pdfmapfile{+knitfont.map} in my .tex file (the knitting package doc told me to include this line)? Because I just got several warnings in the way of pdfTeX warning: pdflatex (file /usr/share/texmf/fonts/map/knitting/knitfont.map ): fontmap entry for knitnn' already exists, duplicates ignored after running pdflatex again. If I remove this line, I don't get any more warnings. –  Anju Fabulina Aug 7 '12 at 15:01
@AnjuFabulina The \pdfmapfile{+knitfont.map} line makes it unnecessary to run updmap-sys`, but it's surely best to have the map file included in the global one. The warning if you add the line is normal; just remove the line or comment it out. –  egreg Aug 7 '12 at 16:17

You are doing too much. Install a stock TeXLive 2012 - it already has the knitting package. Or read the documentation on how to install packages not found in TeXLive. But forget about your TeXLive 2009 from Debian.

-
I have been wondering for ages where to put my personal additions to my TeX Live installation (dumping it all in the "root" part of the system seemed kind of "unclean" to me but I didn't know any better), so this is really helpful. I'm on an ancient Ubuntu 10.04 at the moment, but going to upgrade soon, and then I will go for a non-repo Tex Live install. –  Anju Fabulina Aug 7 '12 at 14:52