Open the output pdf after building using pdflatex in TexnicCenter - pdf

I am using the pdflatex compiler in TeXnicCenter, I wanted to be able to change the output file name, without changing the .tex file name, so I used this line at the start of my file:
%&pfdlatex -job-name=newfile
This method works well, but the compiler doesn't open the pdf automatically anymore, Is there any Command I could use in Viewer instead of the default DDE command to do the job? this is the current command:
[DocOpen("%bm.pdf")][FileOpen("%bm.pdf")]

Related

Vim command line locks until opened file is closed

I am trying to run latex in Vim (without leaving normal mode) in the following way:
Open the document.tex in vim
Compile the .tex file and turn it into a .pdf file. I do this with :! pdflatex %
View the pdf file. I do this with :! %<.pdf
This does show the pdf file (in ms edge) but the command line of Vim is locked: I can't do anything at all until I close the pdf file viewer. This is uncomfortable because, while I only need to compile from time to time, I want to keep the pdf open when correcting mistakes
Why doesn't :! %<.pdf work? Why does the cmd (I'm running this on Windows) "keep running" the command? How can I fix this?

ps2pdf - Unable to open initial device

I built a quite large PDF using LaTeX with the lualatex compiler (I need that one because of specific fonts) and now want to shrink the PDF with ps2pdf, following this instruction (the answer with the second-most votes, since gs is not recognized as a command line tool on my computer). My command looks like this:
ps2pdf -dPDFSETTINGS=/ebook -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -q -sOutputFile=output.pdf input.pdf
I get this error message:
MiKTeX GPL Ghostscript 9.25: Device 'pdfwrite' requires an output file but no file was specified.
**** Unable to open the initial device, quitting.
I definitely made sure that the file exists, I tried it using as *.ps file as input, gave the full path, once with and without double-quotes (Windows system), yet nothing worked. Strangely enough, just running ps2pdf ouput.pdf input.ps works, but produces an even larger PDF. What am I missing?
The file that can't be opened is the output file, so if it exists, that would be a potential problem. If 'something else' has the output file open then it won't be possible to write to it.
You appear to be running a non-standard version of Ghostscript, judging by the startup banner, if I were you I would install and use a standard version of Ghostscript, even if you have to build it yourself.
It's odd that 'ps2pdf' which is just a script to run Ghostscript would work, whereas a simple 'gs' would not. I personally would not use the script. Try and find the Ghostscript executable and run that directly.
I'd drop the -q (quiet) switch as well, at least while trying to solve a problem, suppressing messages could be hiding something useful.
Oh I see, you are actually using Windows. Well, the executable on Windows isn't called 'gs', it's called gswin followed by either 32 or 64 for the word size and then c if it's the command line (as opposed to windowed) version. So you want one of gswin32, gswin32c, gswin64 or gswin64c. Note that the Ghostscript installer doesn't add the installation directory to the $PATH environment variable so if you just open a Windows command shell and type 'gswin32c' it won't be found. You need to either add the isntall directory to the $PATH or supply a full path to the executable.
I'd personally use the vanilla Windows binary rather than a modified version supplied under MingW or whatever Linux shell you are using. It's also conceivable that this is causing your problem writing to the output file, if the directory is unavailable, or read-only, to the shell.

How to specify the file encoding in IntelliJ's command line formatter

After running IntelliJ's command line code formatter on a set of Java source files the German characters in the source are replaced with "garbage".
How can I configure the input and output encoding of the formatter?
I tried adding -encoding iso-8859-15 -docencoding iso-8859-15 as an option to the formatter command line but those options are not recognized.
I also tried creating an idea.properties file with the following content:
-Dfile.encoding=ISO-8859-15
And running the formatter with the environment variable IDEA_PROPERTIES set pointing to this file:
C:\>set IDEA_PROPERTIES="E:\project\config-files\idea.properties"
I also tried inserting the option -Dfile.encoding=ISO-8859-15 directly in the idea.bat file (which is called by the format.bat.
None of these worked.
How can I ensure that the formatter respects the encoding of these source files?
Command line used now is like
C:\>"C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.2.4\bin\format.bat" -r E:\project\java style -m *.java -s e:\project\config-files\CodeStyleSettings.xml
Note: If I convert the source file to UTF-8 before running the formatter the formatting works as expected (the German characters are preserved).
Another note: If the format code is run within the IDE GUI it is possible to set the file encoding in the project options. The command line formatter does not make use of a project so these settings are not respected.
The goal is to turn this into a step in our automated process that can be run by any of a number of users. So I'd like to avoid changes to config files in a user's specific directory like the IDE configuration directory.

How to avoid automatic appended file extensions to directory links when converting to pdf using pandoc?

I'm writing company internal documentation in R markdown and compiling using knitr in Rstudio. I'm trying to add a link pointing to a directory as follows:
[testdir](file:////c:/test/)
(this is following the convention described in here)
When I compile it to html, I get the following link.
testdir
and it works as expected in Internet explorer. However, when I try to convert to pdf straight from RStudio, an unwanted pdf extension is appended to the link. I tried dissecting the problem and it seems this change is happening within pandoc. Here are the details.
When I convert it to latex using pandoc,
>pandoc -f markdown -t latex testing.md -o test.tex
the link in the latex output file looks as follows:
\href{file:///c:/test/}{testdir}
Everything good so far. However, when I convert the latex output to pdf with pandoc,
>pandoc -f latex -t latex -o test.pdf test.tex
a .pdf extension is appended to the link. Here is a copy/paste of the pdf link output:
/c:/test/.pdf
is there a way to avoid this unwanted appended extension?
Perhaps I'm asking too much of pandoc, but I thought it might be worth asking since RStudio is becoming such a useful IDE to write my dynamic documents.
As you said, the .tex file pandoc generates is fine. So the problem is actually with LaTeX, specifically with the hyperref package which is used in pandoc's LaTeX template.
The problem with two possible solutions was described here. To prevent hyperref from being smart and adding a file extensions, try:
[testdir](file:///c:/test/.)
Or use ConTeXt instead of LaTeX:
$ pandoc -t context -s testing.md -o test.tex && context test.tex

how to use API when there's no binary

Normally when I use an API I download the binary containing the JAR which I then add to the classpath. I want to try Curve API but there's no binary (and hence no JARs in the download). I'm using Eclipse and I have read that you can just add the zip file, but I tried this and it didn't work.
Have you read the README.txt in the zip file with Curve API? Let me quote it:
In the src directory, there is a makejar.bat file. This file will
compile the nested Java files and create a Jar file called Capi.jar.
Compilation requires Java 1.2 or higher. After the Jar file is
created, add it to the classpath. Note: CAPI comes with MESP (Math
Expression String Parser).
If you use Windows Vista or 7 or 8, navigate to the folder with makejar.bat, hold Shift and right-click at an empty spot, and select "Open Command Window Here". It will launch console window with cmd.exe; you should be able to see a line like X:\Full\Path\To\The\Folder> in it.
If you use Windows XP or lower, then press Start button, select Run, and type cmd.exeEnter. Then enter cd "X:\Full\Path\To\The\Folder" (the path should be in quotes), and press Enter. If that folder is on the other drive than your current one (shown at the beginning of the prompt), then also type in the letter of the drive where that folder is located, the symbol :, and press Enter.
So much for opening the command window! Now type in makejar.batEnter. I predict that you will see an awful lot of 'javac' is not recognized as an internal or external command, operable program or batch file. lines. If that's so, then please locate javac.exe on your computer somehow—I suggest using Windows Search. After you locate it, go to the folder where it is; click on the address bar of that folder and copy the path to the buffer. Then switch back to the command window, type set PATH=", right-click and chose "Paste", type in ";%PATH%"Enter. After that, try makejar.batEnter—now it should work. If it does, you may also run makeapi.bat which will generate HTML documentation.