[Tex/LaTex] TeXworks won’t open *.cls extensions

installingmiktex

I've always used MikTeX as the main LaTeX base to compile/write my *.tex/*.sty/*.cls files, so I downloaded the specific version 2.9.4521-x64 on my first computer (running Windows 7 Professional); and then the file extensions mentioned above were correctly recognized by the OS, as it can be seen inside a generic folder:

enter image description here

There is a difference regarding the file type (tipo=type) LaTeX Class and LaTeX Style that recognizes automatically the derived extensions; and so on my first machine I've had no problems at all.

The problem rised when bought a new computer, same OS, and installed the same version of MikTeX; then when I looked back on the same folder the file extension for class was no more recognized correctly by Windows:

enter image description here

Here the file type that describes a class file is recognized as CLS file, and not LaTeX Class, because I had to manually connect the program that will be able to read the extension, as it can be seen by the different icon appeared in the aforementioned image.

I know it may seem as a not-so-dramatic issue, but I don't know what is causing it, and since there is an image proof surely something must have happened.


EDIT:
As karlkoeller suggested, removing the current TeXworks version from the MikTeX distribution and installing a brand new one generates this output:

enter image description here

So it looks like I'm back on where I started.

Best Answer

This is what you can do.

I'm assuming that you've installed MiKTeX 64-bit and your installation directory is C:\Program Files\MiKTeX 2.9.

Before proceeding, be sure that the file miktex-texworks.exe exists in the folder C:\Program Files\MiKTeX 2.9\miktex\bin\x64.

Create a file additions.reg with the following contents (adjust it with the right directories if the above assumptions are not right):

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.bib]
@="MiKTeX.bib.2.9"

[HKEY_CLASSES_ROOT\.cls]
@="MiKTeX.cls.2.9"

[HKEY_CLASSES_ROOT\.dtx]
@="MiKTeX.dtx.2.9"

[HKEY_CLASSES_ROOT\.ltx]
@="MiKTeX.ltx.2.9"

[HKEY_CLASSES_ROOT\.sty]
@="MiKTeX.sty.2.9"

[HKEY_CLASSES_ROOT\.tex]
@="MiKTeX.tex.2.9"

[HKEY_CLASSES_ROOT\MiKTeX.bib.2.9]
@="BibTeX Database"

[HKEY_CLASSES_ROOT\MiKTeX.bib.2.9\DefaultIcon]
@="C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\miktex-texworks.exe,-2"

[HKEY_CLASSES_ROOT\MiKTeX.bib.2.9\shell]

[HKEY_CLASSES_ROOT\MiKTeX.bib.2.9\shell\open]

[HKEY_CLASSES_ROOT\MiKTeX.bib.2.9\shell\open\command]
@="\"C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\miktex-texworks.exe\" \"%1\""

[HKEY_CLASSES_ROOT\MiKTeX.cls.2.9]
@="LaTeX Class"

[HKEY_CLASSES_ROOT\MiKTeX.cls.2.9\DefaultIcon]
@="C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\miktex-texworks.exe,-2"

[HKEY_CLASSES_ROOT\MiKTeX.cls.2.9\shell]

[HKEY_CLASSES_ROOT\MiKTeX.cls.2.9\shell\open]

[HKEY_CLASSES_ROOT\MiKTeX.cls.2.9\shell\open\command]
@="\"C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\miktex-texworks.exe\" \"%1\""

[HKEY_CLASSES_ROOT\MiKTeX.dtx.2.9]
@="LaTeX Macros"

[HKEY_CLASSES_ROOT\MiKTeX.dtx.2.9\DefaultIcon]
@="C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\miktex-texworks.exe,-2"

[HKEY_CLASSES_ROOT\MiKTeX.dtx.2.9\shell]

[HKEY_CLASSES_ROOT\MiKTeX.dtx.2.9\shell\open]

[HKEY_CLASSES_ROOT\MiKTeX.dtx.2.9\shell\open\command]
@="\"C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\miktex-texworks.exe\" \"%1\""

[HKEY_CLASSES_ROOT\MiKTeX.ltx.2.9]
@="LaTeX Document"

[HKEY_CLASSES_ROOT\MiKTeX.ltx.2.9\DefaultIcon]
@="C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\miktex-texworks.exe,-2"

[HKEY_CLASSES_ROOT\MiKTeX.ltx.2.9\shell]

[HKEY_CLASSES_ROOT\MiKTeX.ltx.2.9\shell\open]

[HKEY_CLASSES_ROOT\MiKTeX.ltx.2.9\shell\open\command]
@="\"C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\miktex-texworks.exe\" \"%1\""

[HKEY_CLASSES_ROOT\MiKTeX.sty.2.9]
@="LaTeX Style"

[HKEY_CLASSES_ROOT\MiKTeX.sty.2.9\DefaultIcon]
@="C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\miktex-texworks.exe,-2"

[HKEY_CLASSES_ROOT\MiKTeX.sty.2.9\shell]

[HKEY_CLASSES_ROOT\MiKTeX.sty.2.9\shell\open]

[HKEY_CLASSES_ROOT\MiKTeX.sty.2.9\shell\open\command]
@="\"C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\miktex-texworks.exe\" \"%1\""

[HKEY_CLASSES_ROOT\MiKTeX.tex.2.9]
@="TeX Document"

[HKEY_CLASSES_ROOT\MiKTeX.tex.2.9\DefaultIcon]
@="C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\miktex-texworks.exe,-2"

[HKEY_CLASSES_ROOT\MiKTeX.tex.2.9\shell]

[HKEY_CLASSES_ROOT\MiKTeX.tex.2.9\shell\open]

[HKEY_CLASSES_ROOT\MiKTeX.tex.2.9\shell\open\command]
@="\"C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\miktex-texworks.exe\" \"%1\""

At this point, the only thing you have to do is to double-click this file so to add this information into the Windows registry. If you are not able to see the icons, restart Windows.

Related Question