How do I define custom shortcuts in WinEdt 7?

I decided that it makes more sense to post the LaTeX related stuff (and since I use WinEdt for LaTeX editing, WinEdt counts as LaTeX related) on tex.stackexchange.com rather than here. So if you’re wondering about the answer to the above question, have a look at this post. — But do feel free to leave a comment here anyway…

Advertisements

Problems with Winedt 7 and Adobe Acrobat?

I just spent a while trying to solve this problem: the latest version of WinEdt (v7) seems to be unable to close the pdf document that it is working on and therefore can’t compile a new version of it (because Adobe Acrobat is blocking access to the file). I keep getting an error message saying “Cannot Open DDE Link to: “C:\Program Files (x86)\Adobe\Acrobat9.0\Acrobat\Acrobat.exe” Service: AcroviewA10 …” (see screenshot below).

Some posts (can’t find it anymore) suggest that this is not so much a problem of WinEdt but of Adobe constantly changing the interface of their pdf software. Whoever is to blame: I could not find a solution that works with WinEdt 7. Regardless of some people stating that the solution is the same for any version of WinEdt, the idea of  replacing DDE Service Acroview with AcroviewR10 (Acrobat Reader) or AcroviewA10 (Adobe Acrobat) in “PDFCloseDoc.edt” (that’s what the file is called in WinEdt 7) does not work (for me).

So what’s the solution? It’s more a workaround than a solution: don’t use an Adobe product as your pdf viewer when working with WinEdt. You can keep Adobe Acrobat or Adobe Reader and use it as you like, but don’t have it as your pdf Viewer in WinEdt. Use Sumatra pdf instead. WinEdt works fine with it and you no longer need to close your pdf-document manually everytime you compile your LaTeX text.

How do you change the settings in WinEdt? – Go to

Options -> Execution Modes -> PDF Viewer

and change the path to the “PDF Viewer Executable” to wherever you installed SumatraPDF (in my case, it is “C:\Program Files (x86)\SumatraPDF\SumatraPDF.exe” because I have a 64bit version of Windows). Voilà!

WinEdt + biblatex + refsection

This little latex/bibtex problem has cost me some hours today and I could not find anything on the net about this. So maybe this is of help to someone (please let me know in the comments).

Note: this is probably only relevant to you if you use both WinEdt and biblatex with reference sections.

Problem:

I cannot get to WinEdt to work with multiple aux-files automatically. – Why do I need more than one aux-file for? – It comes from biblatex when you use the refsection command to create multiple bibliographies. Biblatex then creates one aux file for each section (marked by \begin{refsection} and \end{refsection}), and consequently bibtex will have to run over each of them. Something like this:

pdflatex mydoc.tex
bibtex mydoc1-blx.aux
bibtex mydoc2-blx.aux
pdflatex mydoc.tex
pdflatex mydoc.tex

(The endings .tex and .aux, are not necessary to run the commands but I include them here for clarification)

The problem with the standard configuration of WinEdt seems to be that all the macros which automatically run bibtex between (pdf)latex apparently don’t understand this special demand from biblatex, they probably just follow the scheme:

pdflatex mydoc.tex
bibtex mydoc-blx.aux
pdflatex mydoc.tex
pdflatex mydoc.tex

Or something like this. I’m not really sure whether this explanation is exactly right, but in any case, I did not manage to get WinEdt to run properly on a document with refsections.And if I had understood the core of the problem earlier, it would have saved me some time.

For someone who is good at writing macros for WinEdt, it surely is not a problem to fix this, but I don’t have the time now to go into this. If you have a solution for this or a correction regarding the above, please post it in the comments.

Workaround:

For now, the only workaround for me, at the moment, is the following:

  1. Run pdflatex by clicking the pdflatex icon in WinEdt
  2. Open a command prompt window and run bibtex on the two files (i.e. bibtex mydoc1-blx and bibtex mydoc2-blx where “mydoc” stands for the file name of by main tex-document)
  3. Run pdflatex twice by clicking the pdflatex icon in WinEdt

You can, of course also run pdflatex manually at the command prompt or write a script or fly to the moon, but since bibtex only needs to be run when my references change, this is most convenient to me.

Finally:

I know that it is very much recommended to use biber instead of bibtex when using biblatex and I would like to do that (especially now that both biber and biblatex are finally part of the MikTeX package). But: I did not get biber to run with WinEdt either. The solutions that I found on the web (here and here) did not work for me because they are not for WinEdt 5.5 but even when I tried them out on a trial version of WinEdt 6, they did not work for me. It just comes to my mind that  that might have been related to the use of refsections (i.e. same problem as with bibtex described above). But since the main point of this post is the combination of WinEdt + biblatex + refsections, I won’t go into this.

Cite original year using biblatex

Just a brief note for those who want to include the original year of publication in a citation when using biblatex (e.g. “Weber (1922/1978)” instead of “Weber (1978)”) .

If you are using one of the author-year styles (or author-year-icomp-tt) and biblatex version 0.8 you could easliy do this by including the following in your biblatex.cfg file:

\renewbibmacro*{cite:year+labelyear}{%
\printtext[bibhyperref]{%
\iffieldundef{origyear}{}{\printfield{origyear}\addslash}%   <--- added
\printfield{year}%
\printfield{labelyear}}}

\renewbibmacro*{year+labelyear}{%
\iffieldundef{year}
{}
{\printtext[parens]{%
\iffieldundef{origyear}{}{\printfield{origyear}\addslash}%   <--- added
\printfield{year}%
\printfield{labelyear}}}}

But things have changed with biblatex 0.9 so that this no longer works. It took me a while to figure out why and so I publish my solution here since I could not find it anywhere on the net.

The reason is that the macros which print the year (in the citation and in the bibliography) have changed. So the additional line that inserts the original year (see above) has to be inserted into two different macros:


\renewbibmacro*{cite:labelyear+extrayear}{%
\iffieldundef{labelyear}
{}
{\printtext[bibhyperref]{%
\iffieldundef{origyear}{}{\printfield{origyear}\addslash}%   <--- added
\printfield{labelyear}%
\printfield{extrayear}}}}

\renewbibmacro*{date+extrayear}{%
\iffieldundef{year}
{}
{\printtext[parens]{%
\iffieldundef{origyear}{}{\printfield{origyear}\addslash}%  <--- added
\printdateextra}}}

Just add this into your biblatex.cfg file and look at the results. – If the original year still doesn’t show up, then you probably have to update your bib-file: the field origyear is no longer supported by biblatex (though it is still used internally). It is now called origdate (see release notes).  So what you have to do is simply replace all instances of “origyear” by “origdate”. Now it should work fine!

P.S. If you want to sort the titles in the bibliography according to the original year rather than the year of the used edition, just add sortyear = {1922} to each entry in your bib-file which has an origdate entry (of course “1922” stands for whatever the original year is).