4

Maybe this is asking too much, or again maybe it is easy and i just missed the instructions.

Sometimes while working on a project, in WinEdt, with a set Main File, I need to look at TeX files that do not belong in the project. So, I can open any such file and read it as a source file (and then close it again before saving the project). But so far as I know now, I cannot show its pdf while the project is open, since it is not included in the Main File of the project.

Is there a command that would show the pdf of a file not in the project without closing or changing the project? As Ulrike Fischer comments I could unset and then afterwards reset the main file. Or I can close the project and look at the pdf of the other file. But I often want to go back and forth a lot and that kills a lot of time. Is there a quicker way way to access the pdf of a file that is not included in the project?

Note this is opposite to the question Compiling multi-file LaTeX file since OP of that question did want to compile the project and not some other file.

1
  • 2
    You can change the current main file with project -> set main file (Ctrl + F5). Commented Nov 25, 2017 at 15:19

1 Answer 1

5

You cannot do this with default WinEdt settings.

Nevertheless, if all you need is a shortcut for this, let's say Shift+Alt+R, simply do the following.

Go to "Options" -> "Options Interface" and double-click the "Main Menu" item:

enter image description here

A local copy of MainMenu.ini gets opened. In this file, just after the lines

MENU="Shortcuts"
  CAPTION="Shortcuts"
  INVISIBLE=1

add the following lines

  ITEM="$View_Current_PDF"
    CAPTION="View Current PDF"
    MACRO=`Assign('Main_File','%!F');SetMainFile('%f');`+
          `Exe('%b\Exec\PDF\PDF Preview.edt');`+
          `SetMainFile('%$(|Main_File|);');`
    SHORTCUT="41042::Shift+Alt+R"
    REQ_FILTER="%p\%n.pdf"

At this point press Shift+Ctrl+F9 to reload the file.

Now the shortcut Shift+Alt+R opens the pdf related to the current file, while Shift+Ctrl+R opens the pdf related to the main file.

If you don't like Shift+Alt+R as a shortcut for this, simply double-click on the keyword SHORTCUT in the code and change it.

1
  • 1
    Worked perfectly on the first try. Commented Nov 25, 2017 at 19:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .