Error in creating PDF in Latex in Texstudio - pdf

I want to create presentation in latex. Following is the code :
\documentclass{beamer}
\usetheme{default}
\title{Electrical Machines}
\subtitle{Electromechanical Energy Conversion}
\author{Vivek kumar Pal}
\institute{Department of Electrical Engineering\\VJTI}
\date{\today}
\subject{Electricals}
\begin{document}
\end{document}
Code is getting executed properly. But following error is coming for creating pdf :
does not look like a valid PDF document. Either the file is corrupt or it is in the process of creation. Retrying every two seconds.
Kindly help in this and let know the reason.

You are missing content. Once you add it it will work properly.
\documentclass{beamer}
\usetheme{default}
\title{Electrical Machines}
\subtitle{Electromechanical Energy Conversion}
\author{Vivek kumar Pal}
\institute{Department of Electrical Engineering\\VJTI}
\date{\today}
\subject{Electricals}
\begin{document}
Enter content here.
\end{document}
`

Related

How can I insert and fit a PDF file using Latex commands

\begin{figure}[ht]
\begin{center}
\includegraphics[height = 3.5\textheight, width = 3.0\textwidth]{fig/InterfaceEMF2ASMFOR}
\end{center}
\caption{list of global parameters customer, FRD versions} \label{fig: limit}
\end{figure}
is the code I have used in my Latex file.
NOTE: {fig/InterfaceEMF2ASMFOR} is a pdf file
After the pdf report got generated the included {fig/InterfaceEMF2ASMFOR} does not look good and not fit to the page in PDF report.
The inserted pdf always loose some portion of it and always inserted from the middle of the page but not from the edges of the page.
Please help me how to fit the fig to the PDF I am creating.
You can include the whole pdf page with the pdfpages package:
\documentclass{article}
\usepackage{pdfpages}
\begin{document}
test
\includepdf{example-image-a4}
text
\end{document}

Is it possible to use the LaTeX packages "subfiles" and "background"?

I ran into a problem using the packages "subfiles" and "background" in my LaTeX project.
I have a main file that looks like this:
\documentclass[10pt, a4paper, parskip]{scrartcl}
\usepackage[pages=some, angle=0, opacity=1, scale=1]{background}
\usepackage{subfiles}
\definecolor{background}{RGB}{204, 68, 68}
\begin{document}
\subfile{subfile1}
\subfile{subfile2}
\end{document}
I want to include two subfiles. The first subfile looks like this:
\documentclass[main.tex]{subfiles}
\begin{document}
\backgroundsetup{
contents={
\begin{tikzpicture}[overlay]
\path [fill=background] (-.5\paperwidth, 6) rectangle (.5\paperwidth, 9.25);
\end{tikzpicture}
}
}
\BgThispage
Text...
\end{document}
The second subfile looks similar but has a different background setting:
\documentclass[main.tex]{subfiles}
\begin{document}
\backgroundsetup{
contents={
\begin{tikzpicture}[overlay]
\path [fill=background] (-.5\paperwidth, -12.5) rectangle (.5\paperwidth, 12.5);
\end{tikzpicture}
}
}
\BgThispage
Text...
\end{document}
Compiling the two subfiles as standalone files gives me the expected result. But compiling the main file does not set the backgrounds right, even the file compiles without errors.
Is it possible to fix this error or are there working alternatives for the packages "subfiles" or "background" that work together?
EDIT: I changed the main file to this:
...
\begin{document}
\subfile{subfile1}
\newpage
\subfile{subfile2}
\end{document}
...
Now I only see the watermark saying "draft" when compiling the main file, but it is set to the correct pages.
EDIT: I figured out that the watermark appears if the included subfile is just one page long. If the content is at least two pages long the background is displayed correctly. Does anyone know why?
I found a way to solve the issue. In the main file delete the \newpage command and in every subfile end the code with a \newpage command. This way the compilation of the main file and of all subfiles as standalone files works correctly.
Here is the comment that told me so.

Using a list in a text file as a list in Latex \foreach loop

Sorry if I didn't tag\classify this well. But here is my problem
I have a list generated by another program which goes into a text file, when I want to simply include this text in my latex document i use \input{writing.txt} this works fine.
The issue i'm having is figuring out a way to use a text file that has a list like
picnname1 picname2 picname2 ... and have latex recognize that as my list, included in \input{list.txt}
Below is a broken example, which works when I replace \input{list.txt} with the actual list. My attempts so far have gotten me nowhere. So any help would be greatly appreciated.
\documentclass{article}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{python}
\usepackage{graphicx}
\usepackage[space]{grffile}
\usepackage[latin1]{inputenc}
\usepackage[top=2cm]{geometry}
\foreach \picname in {\input{list.txt}}
{
\section{\MakeUppercase\picname}
\begin{figure}[h]
\centering
\includegraphics[width=10cm]{\picname_Main.pdf}
\caption{This depicts the trend in \picname}
\end{figure}
\input{"filepathforsometext"\picname.txt}
\input{"filepathforatable"\picname_GrowthTable}
\input{"filepathforanothertable"\picname_ActualPop}
\clearpage
}
\end{document}

Importing *.pdf_tex file error

I have made a graphic with inkscape. Now I'm trying to build it in Latex. I' m working with TEXMaker. Therefore I have exported my graphic as *.pdf_tex and *.pdf.
In macros i have added the following
\usepackage{color}
\usepackage{transparent}
\graphicspath{{fileWithPictures/}}
my picture is build in like this:
\begin{figure}
\centering
\def\svgwidth{175pt}
\input{fileWithPictures/pic.pdf_tex}
%\includegraphics[width=2in]{fileWithPictures/pic.pdf_tex}
\end{figure}
Here I'm getting the following error. "!Package pdftex.def Error: File'pic.pdf" not found. See the pdftex.def package.."
I have tryed also to work with includegraphics which not succed. Because there he it doesn't recognize pdf_tex format.
Interesting is that the compiler says that there is not a file called "pic.pdf" and not "pic.pdf_tex". Althought both files are clearly in the file. To be sure i put the pic.svg file in the file. Now i have no more ideas and would be happy to get some help
Thanks
Use resizebox to set the width of your file instead of \def\svgwidth{175pt} it will solve your problem
\resizebox{\textwidth}{!}{
\input{fileWithPictures/pic.pdf_tex}
}

Knitr + Beamer to PDF: Incorrect Font Symbols

I'm using TexStudio 2.8.4 to create a pdf containing knitr output and I'm running into issues with symbols showing up incorrectly either in the pdf or when copy and pasted from the pdf. Here's a minimal working example.
\documentclass{beamer}
\begin{document}
\begin{frame}[fragile]
<<>>=
#dollar$sign
if(2+2 == 4){print("math")}
#
\end{frame}
\end{document}
In my pdf output, the $ in the commented out font shows up as the pound (currency) sign, but when copy and pasted shows up correctly as a dollar sign. This does not occur when it is not commented out.
More problematically, while the braces {} appear correct in the pdf output, when copied and pasted they are f and g. This confusion does not affect R's interpretation of the braces, however.
Do you have any thoughts/suggestions for fixing this? As a work around, I'm just using a non-echoed knitr block and using a latex verbatim environment for the code on the front side, though this is not ideal.
The command I'm using in my custom build is:
"C:/Program Files/R/R-3.2.2/bin/Rscript.exe" -e "library(knitr); knit2pdf('%.Rnw')" | pdflatex -synctex=1 -interaction=nonstopmode %.tex | "C:/Program Files (x86)/Adobe/Reader 11.0/Reader/AcroRd32.exe" "?am.pdf"
Cheers!
This seems to be a problem with LaTeX encoding. The solution is adding \usepackage[T1]{fontenc} to your preamble as suggested here.