Insert .tex file in Lyx with references - latex

I wrote a draft of a paper in LaTeX. Now my advisor wants the whole thing in Lyx. Equations and all that import just fine using "File -> Import -> LaTeX (plain)" but the natbib references (e.g. \citet{nash1950game}) show us as ERT (evil red text, or LaTeX code in red boxes). Do I have to add all these references manually? Or is there a workaround?

Related

Rmarkdown journal template rendering inverted exclamation mark (¡) in table, while .tex has correct less than symbol "<"

I'm writing a paper using the ACM manuscript latex template in Rmarkdown. I have a table including p values, which have been formatted with scales::pvalue() to get the < symbols in there instead of long almost-zero numbers.
The problem I'm having is that even though in the .tex file that gets produced from my Rmarkdown has the correct symbol, it still gets rendered as (¡) on the pdf.
I'm aware this is probably related to https://tex.stackexchange.com/questions/2369/why-do-the-less-than-symbol-and-the-greater-than-symbol-appear-wrong-as, but as the class I'm using as part of the template already uses T1 font encoding, I'm at a loss for how to solve this.
I am also unable to recreate the problem in overleaf. Pasting what the latex script for the table into https://www.overleaf.com/latex/templates/acm-conference-proceedings-primary-article-template/wbvnghjbzwpc works as expected.
Turns out that there was a TinyTex package missing - I compiled with MikTex and it worked, so then I ran tinytex::install_yuhui_pkgs() and it finally worked.
Thanks #samcarter_is_at_topanswers.xyz for your help.

Render latex preview of equation like in latex export (with preceeding/trailing newline)

I am struggling with latex preview in org-mode.
Basically I am trying to preview someting like this:
* Section2
\[
X=\frac{1}{2}
\]
In general this works, but the overlay image does not contain preceeding/trailing newlines before/after the math environment. Full latex export however would introduce these newlines.
In addition I use the following options in my header in order to keep the original org spacing in my pdf:
#+OPTIONS: \n:t
The combination of employed header and fragment mismatch, however, either messes up readability of my org file, i.e. the preview fragment is put too close to the heading "Section2". Or, when I insert a new line in org, in order to increase the readability, the spacing of my latex export looks strange, due to this extra line plus the preceeding/trailing lines from the math environment.
Can someone give me a hint how I can convince org-mode to create the fragment in accordance with the full latex export?
I am using emacs 26.3 with miktex.
Thanks,
Daniel

How to include a LaTeX paper into another LaTeX paper in OverLeaf?

I have LaTeX paper that I need to include in my dissertation. I am working in OverLeaf. That paper was written under one document class while the university has its own class. I need to include the paper in the dissertation so that it has the university style, its images need to be listed in the list of figures of the dissertation, and the authors listed in the paper's bibliography needs to be listed in the university's class bibliography. Is there any way I can do that in OverLeaf?
There are several dedicated packages for this. For example have a look at the combine, subdocs or docmute packages (A list with even more suggestions can be fond at https://www.ctan.org/recommendations/docmute).
Here a short example with the docmute package
\documentclass{book}
\usepackage{lipsum}
\usepackage{docmute}
\begin{document}
\tableofcontents
text
\chapter{imported paper}
\input{test}% assuming your paper is called test.tex
\end{document}
A Latex document cannot have multiple \documentclass. One solution would be to split the header/content of your latex document in overleaf:
Create a master.tex with the documentclass and put all your content (text between \begin{document} and \end{document} in a second content.tex. In the master, just \input{content}.
In your dissertation, just copy content.tex, its figure and add \input{} in the master file of your University which has the specific documentclass and bibliography settings.

How to include both Agda and Isabelle code in the same latex file?

I am creating presentation slides using beamer, and on the slides I want to include pieces of code from Agda and Isabelle standard libraries. All I can find online is generating latex from Agda (lagda) or from Isabelle (document preparation). I want to go the other way, as my slides will have code from different systems.
I can still use lstlisting or verbatim, but I would rather not copy-paste and reformat code.
I would prefer to have something like including line numbers from files, or maybe code between tags
Your best bet is to use the catchfilebetweentags package: given two files IsabelleCode.tex and AgdaCode.tex generated by the respective LaTeX backends of each language, you can capture the code between an opening tag %<*TAGNAME> and a closing tag %</TAGNAME> in either file by using the appropriate directive e.g.:
\ExecuteMetaData[IsabelleCode.tex]{TAGNAME}
\ExecuteMetaData[AgdaCode.tex]{TAGNAME}
With \lstinputlisting from the listings package, you can directly include code from the source file. Optionally you can specify the start and end line numbers
\documentclass{beamer}
\usepackage{listings}
\lstset{basicstyle=\ttfamily}
\begin{document}
\begin{frame}[fragile]
\lstinputlisting[firstline=1,lastline=7,language=C]{duck.C}
\end{frame}
\begin{frame}[fragile]
\lstinputlisting[firstline=1,lastline=7]{test.agada}
\end{frame}
\begin{frame}[fragile]
\lstinputlisting[firstline=1,lastline=7]{test.isabelle}
\end{frame}
\end{document}
At least for Agda, you can render individual .lagda modules into LaTeX. If you can do the same with Isabelle's pretty-printer, you should be then able to write toplevel LaTeX by hand, and then import (parts of) the Agda and Isabelle-generated LaTeX where appropriate.

Import specific section from another tex file

I'm trying to import a very specific section or subsection from another latex document. I basically have an export tool that creates a nice tex document and makes the sections for the headers. It's nice to call the whole file but at some point in my combined document I have to just call a subsection over and over again.
How do I call a specific subsection from a whole document?
I have a file call aa.tex and I'm able to use \subimport{}{aa} and it brings in the whole file.
In the file it look similar to
\section{Test Descriptions}
\subsection{Setup}
Hardware and Software... CPU, GPU, RAM etc
\subsection{test1}
\subsubsection{Steps1}
a,b,c,
\subsubsection{Steps2}
a,b,c
I want to be able to call \subsection{setup} over and over again because of what I have to reference.
So, logically how do I only call \subsection{Setup} from aa.tex?
With the catchfilebetweentags package one can selectivity input parts of a file
Main file:
\documentclass{article}
\usepackage{catchfilebetweentags}
\begin{document}
zzz
\ExecuteMetaData[subdocument]{setup}
zzz
\ExecuteMetaData[subdocument]{setup}
\end{document}
subdocument.tex:
xxx
%<*setup>
\subsection{Setup}
%</setup>
xxx

Resources