I am writing the following code in TeXstudio:
% !TeX encoding = UTF-8
% !TeX spellcheck = en_US
\documentclass{report}
% Este pacote abaixo é relacionado à acentuação.
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}
\begin{document}
\chapter{Isso é um capítulo}
\section{Esta é a primeira seção}
\section*{Esta é uma seção}
Meu primeiro documento. É isso aí
\subsection{Esta é uma subseção}
Conteúdo subseção
\subsubsection*{Esta é uma subsubseção}
\end{document}
And with option brazil at babel package I receive the error bellow:
File
Type
Line
Message
babel.sty
error
line 1042
Package babel Error: Unknown option `brazil'. Either you misspelled it. \ProcessOptions*
I am using:Ubuntu 22.04, TeXstudio 4.2.1 and babel 2020/09/01 3.48 The Babel package
I have already try to remove and install:
sudo apt-get install texlive-lang-portuguese
or
sudo apt-get install textlive-lang-all
and nothing works....
What is the problem and how can i solve it?
Found it.
There were two different packages locations in my machine.
~/.Tinytex
and
/usr/share/texlive
I have deleted the .Tinytex and everything works right now.
Related
I'm using a arm64 machine and trying to build a gcc cross-compiler, so i want to install both bison and flex, but i get this error(even after "sudo apt-get update && sudo apt-get upgrade")
Il pacchetto flex non ha versioni disponibili, ma è nominato da un altro
pacchetto. Questo potrebbe indicare che il pacchetto è mancante, obsoleto
oppure è disponibile solo all'interno di un'altra sorgente
E: Il pacchetto "flex" non ha candidati da installare
for both flex and bison.
What should i do?
I installed the following packages according to what ArchLinux officially said:
Archlinux TexLive
$ sudo pacman -S texlive-most texlive-langchinese
I compile it like this:
\documentclass[UTF8]{ctexart}
\begin{document}
中文文档类测试。
\end{document}
$ pdflatex demo.tex
This is pdfTeX, Version 3.141592653-2.6-1.40.23 (TeX Live 2021/Arch Linux) (preloaded format=pdftex)
restricted \write18 enabled.
entering extended mode
(./demo.tex
! Undefined control sequence.
l.1 \documentclass
{ctexart}
?
! Undefined control sequence.
l.2 \begin
{document}
?
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] )</usr/share/texmf-dist/
fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on demo.pdf (1 page, 12721 bytes).
Transcript written on demo.log.
However, the result obtained is this:
Is this because I didn't add Chinese fonts? Or some other reason?
This problem is caused by my lack of understanding of the tex typesetting system.I used pdflatex directly which doesn't support Unicode character set, which is very stupid.Documents should be compiled with xelatex for the Unicode character set.
Here's the simplest LaTeX file:
\documentclass[12pt]{article}
\title{How to write a report in LaTeX}
\author{ABC\\abc_z#yahoo.com}
\date{May 2021}
\begin{document}
\maketitle
Hello World
\end{document}
But when I Quick Build then it gives the following ERRORS:
! Missing $ inserted.<inserted text>$ \maketitle
! Extra }, or forgotten $.<template> \unskip \hfil }\hskip \tabcolsep \endtemplate \maketitle
! Missing $ inserted.<inserted text>$ \maketitle
! Missing } inserted.<inserted text>} \maketitle
I got it. I have used _ , with that it gives error. One needs to either remove _ or use \ with, as \_ , then it works.
How to automatically compile two versions of the same document, for example version without answers for the students and another version with answers for myself?
I have a small bash script to do a dual format.
function latex-ans () {
n=$(basename $1 .tex) # strip .tex in filename foo.tex -> foo
ln -s $n.tex $n-ans.tex # create a soft link (for instance foo-ans.tex -> foo.tex)
pdflatex '\def\withanswer{1} \input{'$n-ans'}' && pdflatex $n
% first format the version with answers and then the normal version
rm $n-ans.tex $n-ans.log
% remove useless files
}
If I have a file foo.tex, this commands formats both versions of the file and generates two pdf: foo.pdf and foo-ans.pdf. Thanks to the renaming of foo.tex through the ln -s, it also keeps separate foo.aux and foo-ans.aux to preserve useful information on both versions.
At the latex level, I basically do the same and use the macro \withanswers to configure my packages.
There are several packages that allow to conditionally exclude certain parts of the document, for example the exercise package.
With TeXstudio, the following magic comment can be used to automatically compile both versions at once (including repeated compilation for cross-references, bibliographies, indices etc.):
% !TeX program = latexmk -pdf -pdflatex="pdflatex -synctex=1 -interaction=nonstopmode -shell-escape" -jobname=% -pretex="\newcommand{\version}{noanswer}" -usepretex % | latexmk -pdf -pdflatex="pdflatex -synctex=1 -interaction=nonstopmode -shell-escape" -jobname=%_solution -pretex="\newcommand{\version}{}" -usepretex % | txs:///view-pdf "?am)_solution.pdf"
\documentclass{article}
% setting a default value in case it is compiled without the magic comment
\ifdefined\version
\else
\def\version{noanswer}
\fi
\usepackage[\version]{exercise}
\begin{document}
\begin{Exercise}[title={Title},label=ex1]
question text
\end{Exercise}
\begin{Answer}[ref={ex1}]
solution
\end{Answer}
\end{document}
I created a new Rmd file in the latest R and Rstudio version, and with the complete version of MiKTeX installed. In my windows 10 machine.
When I tried to knit it I got the following error
! LaTeX Error: File `fancyvrb.sty' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)
Enter file name:
! Emergency stop.
<read *>
l.34 \newcommand
pandoc.exe: Error producing PDF
Error: pandoc document conversion failed with error 43
Además: Warning message:
comando ejecutado '"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS pdfprueba.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output pdfprueba.pdf --template "C:\Users\karin\Documents\R\win-library\3.3\rmarkdown\rmd\latex\default-1.17.0.2.tex" --highlight-style tango --latex-engine pdflatex --variable graphics=yes --variable "geometry:margin=1in"' tiene estatus 43
Ejecución interrumpida
I suspected that it could have been that I didn't have the package fancyvrb in MiKTeX , so I followed these instructions but I still get the same error.
Try the same using
Miktex package manager (admin)
Under > repository check that your package repository is up to date.
In the name box type the name of your package
Then filter
then add your package
To test if your package is installed in dos CMD type
kpsewhich fancyvrb.sty. you should be able to see the path to your package.
Microsoft Windows [version 10.0.15063]
(c) 2017 Microsoft Corporation. Tous droits réservés.
C:\>kpsewhich fancyvrb.sty
C:/Users/me/AppData/Roaming/MiKTeX/2.9/tex/latex/fancyvrb/fancyvrb.sty