I am working on a report, which contains an equation involved gradient. So I need the nabla symbol to be printed out like this:
But actually, I finally got a black disc as I try to input the nabla symbol:
I don't know if it is the problem of my code:
$\nabla_{w}\mathcal{L}(w, b, a)$
As for background details, I use TeXShop4.38 on macOS 10.14.6, the packages are the following:
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{txfonts}
\usepackage{fdsymbol}
\usepackage{graphicx}
\graphicspath{{secret}}
\DeclareMathOperator*{\argmax}{argmax}
\DeclareMathOperator*{\argsup}{argsup}
Can anyone help me target the problem? Thanks a lot!
You can find the root cause of such problems by creating a minimal example, i.e. the minimum amount of code that is needed to reproduce the problem. In your case that would be:
\documentclass{article}
\usepackage{fdsymbol}
\begin{document}
$\nabla_{w}\mathcal{L}(w, b, a)$
\end{document}
Indeed, the documentation for fdsymbol states that it does not contain a symbol for \nabla. One simple solution would be loading txfonts after fdsymbol. Alternatively, you could update to the more modern newtxtext and newtxmath:
\documentclass{article}
\usepackage[full]{textcomp}
\usepackage{fdsymbol}
\usepackage{newtxtext,newtxmath}
\begin{document}
$\nabla_{w}\mathcal{L}(w, b, a)$
\end{document}
Result:
Notes:
textcomp is needed because both dfdsymbol and newtxtext load is with different options.
You have to decide yourself if fdsymbol is still needed in this case.
Related
I am typesetting an A5 document, which includes a music environment as provided by musixtex.
I would like to reduce the linewidth/textwidth of just the music.
Here are a few things, that I have tried:
Put the music inside a minipage. This works fine for short excerpts but for longer music there might be the necessity of a page break, which a minipage doesn't have.
Use the \newgeometry command and subsequently \restoregeometry. That works, but apparently inserts a \newpage, which I also would like to avoid.
Use the changepage package which provides the command \adjustwidth. This works on the left side of the page, but the music then doesn't produce the linebreak at the desired position, but shifted to the right. I provide a MWE of this below.
Use a list-like environment like trivlist or itemize. This works on the left side of the page, but the music then doesn't produce the linebreak at the desired position, but shifted to the right, basically the same as above.
\documentclass{article}
\author{Myself}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\geometry{a5paper}
\geometry{twoside}
\geometry{inner=1.375cm}
\geometry{outer=1.375cm}
\geometry{top=1.5cm}
\geometry{bottom=1.5cm}
\usepackage{changepage}
\usepackage{musixtex}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\begin{adjustwidth}{0.5cm}{0.5cm}
\begin{music}
\instrumentnumber{1}
\setstaffs1{1}
\generalmeter{\meterfrac{9}{4}}
\generalsignature{-1}
\nostartrule
\normalmusicsize
\nobarnumbers
\startpiece
\NOtes\qu{ff}\ql{j}\en\bar
\NOtes\qup{h}\cu{g}\qu{fedc}\en
\NOtes\qu{def}\en\bar
\NOtes\hup{gf}\en\rightrepeat
\NOtes\ql{jjj}\en\bar
\NOtes\hlp{k}\qu{h}\ql{ij}\en
\NOtes\qlp{j}\cl{i}\qu{h}\en\bar
\NOtes\hup{g}\qu{cdefgh}\en\bar
\NOtes\hup{gf}\en
\Endpiece
\end{music}
\end{adjustwidth}
\lipsum[2]
\end{document}
To me, both 3) and 4) seem to not work because musixtex doesn't understand/know the new settings for the linewidth etc.
More info: I am aware of the way that musixtex code has to be compiled, I am using a makefile that invokes pdflatex, musixflx and pdflatex again. This is not the cause of the problem.
Any help would be appreciated
You could use tcolorbox to create a breakable box:
\documentclass{article}
\author{Myself}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\geometry{a5paper}
\geometry{twoside}
\geometry{inner=1.375cm}
\geometry{outer=1.375cm}
\geometry{top=1.5cm}
\geometry{bottom=1.5cm}
\usepackage{changepage}
\usepackage{musixtex}
\usepackage{lipsum}
\usepackage[most]{tcolorbox}
\tcolorboxenvironment{music}{breakable,text width=\dimexpr\textwidth-2cm,enhanced,grow to left by=-1cm,colframe=white,colback=white}
\begin{document}
\lipsum[1]
\begin{music}
\instrumentnumber{1}
\setstaffs1{1}
\generalmeter{\meterfrac{9}{4}}
\generalsignature{-1}
\nostartrule
\normalmusicsize
\nobarnumbers
\startpiece
\NOtes\qu{ff}\ql{j}\en\bar
\NOtes\qup{h}\cu{g}\qu{fedc}\en
\NOtes\qu{def}\en\bar
\NOtes\hup{gf}\en\rightrepeat
\NOtes\ql{jjj}\en\bar
\NOtes\hlp{k}\qu{h}\ql{ij}\en
\NOtes\qlp{j}\cl{i}\qu{h}\en\bar
\NOtes\hup{g}\qu{cdefgh}\en\bar
\NOtes\hup{gf}\en
\Endpiece
\end{music}
\lipsum[2]
\end{document}
I have searched but nothing useless, only "use \newline" or "use \".
I'm creating a simple latex document to store any texts instead of using .txt, and the problem is that the pdf document contains the lines going towards right until they go out of the paper.
I'm using this simple code
\documentclass[a4paper]{article}
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=5mm,
top=20mm,
}
\begin{document}
\section{Text 1}
Loremipsumdolorsitamet,consecteturadipiscingelit,seddoeiusmodtemporincididuntutlabore etdoloremagnaaliqua.Utenimadminimveniam,quisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequat.Duisauteiruredolorinreprehenderitinvoluptatevelitessecillum doloreeufugiatnullapariatur.Excepteursintoccaecatcupidatatnonproident,suntinculpaquiofficiadeseruntmollitanimidestlaborum.
\end{document}
Since latex sees it as a one word, it refuses to break it since it doenst know its hyphenation. But I would like to allow latex to break it regardless. Any thoughts ?
Remarks: I already have used:
\hspace{0pt}
\leavevmode\nobreak\hspace{0pt}
\mbox{Loremip...larorum.}
Nothing worked.
I think I got why nothing worked. See my code below, that I managed to compile successfully after editing your MWE.
You basically have two ways to force hyphenation here.
As in the comment by SamCarter, you manually split words within text, just using \- where necessary. I did it below in line 18 (6 from bottom).
You add to your preamble the command \hyphenation{word-to-split}: I did this below to hyphenate the word in line 20 (4 from bottom). Notice that, in this case, you use - instead of \- within the braces {} enclosing the argument.
\documentclass[a4paper]{article}
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=5mm,
top=20mm,
}
\hyphenation{Duisauteiruredolorinre-prehenderitinvoluptatevelitesse-cillum doloreeufugiatnullapariatur}
\begin{document}
\section{Text 1}
Loremipsumdolorsitamet, consecteturadipiscingelit,
seddoeiusmodtemporincididuntutlaboreetdoloremagna.
Uten\-imadminimveniam,
quisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequat.
Duisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeufugiatnullapariatur.
Excepteursintoccaecatcupidatatnonproident,
suntinculpaquiofficiadeseruntmollitanimidestlaborum.
\end{document}
Finally, if the full stop character . is not followed by a space, two separate words may be interpreted as one and the command \hyphenation may not work as expected. Not sure that this was the detail making you write that nothing worked, but be careful to this too.
How do I combine \afterpage and \endfloat to easily switch between having figures and tables at the end of the document or having them in the text?
I want to easily choose between my figures at the end of the document and my figures in the text. Because of that, sometimes I will use \afterpage package and other times I will use \endfloat would be nice to combine both.
Right now, all the times I try to run \endfloat when I have a clear page, I get the following message:
Argument of \efloat#xfloat has an extra }.
I already tried to include after page in the DeclareDelayedFloatFlavor, something like:
\DeclareDelayedFloatFlavor{afterpage}{figure}
It did not work.
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{float}
\usepackage{afterpage}
% ---------------------
%figures at the end
% ---------------------
\usepackage[nolists]{endfloat}
% force landscape at the end
\begin{document}
{\afterpage{
\begin{figure}
\end{figure}
}
\end{document}
If you want to switch between having figures within the text and at the end, I suggest to only use the endfloat package. Commenting or commenting it's optional argument disable will allow you to quickly alternate between figures at the end or in the text.
I'm not entirely certain what the purpose of afterpage was in your example, but if you used it to move the figure to a separate page, this can conveniently be done with the p floating specifier.
\documentclass{article}
\usepackage[
disable
]{endfloat}
\begin{document}
test
\begin{figure}[p]
xxx
\caption{caption}
\end{figure}
test
\end{document}
I'm using a LaTeX template (provided by ASME) to write a conference paper.
The asme2e.cls class defines a "nomenclature" environment as follows:
% Nomenclature environment
\newbox\tempbox
\newenvironment{nomenclature}{%
\newcommand\entry[2]{%
\setbox\tempbox\hbox{##1.\quad}
\hangindent\wd\tempbox\noindent{##1}\quad\ignorespaces##2\par}
\section*{NOMENCLATURE}}{\par\addvspace{12pt}}
which is used, in the .tex source file, as follows:
\begin{nomenclature}
% [...]
\entry{$C_{visc}$}{Viscous friction coefficient.}
\entry{$M$}{Spool mass.}
% [...]
\end{nomenclature}
resulting in the description texts not being left justified (since a fixed horizontal space is inserted between the symbol (e.g.: M) and the description (e.g.: Spool mass.), but the symbols have different lengths (e.g.: Cvisc is longer than M).
Is there a way to fix the class to have left-justified descriptions?
(I did a few experiments with \dimexpr and the calc package, but just got a bunch of errors).
(I also asked ASME if they could provide an updated template, but I'm still waiting for their feedback...)
I couldn't solve the problem, but I found a "quick and dirty" workaround, using the Tabbing and setspace packages.
Here is the new .tex source:
%[...]
\usepackage{Tabbing}
\usepackage{setspace}
%[...]
\begin{nomenclature}
{\setstretch{1.1}
\begin{tabbing}
\noindent
% [...]
\entry{$C_{visc}$}\quad\quad\={Viscous friction coefficient.}\\
\entry{$M$}\>{Spool mass.}\\
\entry{$v$}\>{Spool velocity.}\\
% [...]
\end{tabbing}
} % end \setstretch
\end{nomenclature}
%[...]
(Clearly, I'm completely bypassing the \entry command defined by the asme2e.cls class for the nomenclature environment).
I also tried to edit the asme2ej.cls file but nothing working for me. Then I ended up using the tabbing and set space packages. However, I did not use the \setstretch, and my document compiled just fine.
%[...]
\usepackage{Tabbing}
\usepackage{setspace}
%[...]
\begin{nomenclature}
\begin{tabbing}
\noindent
\entry{XYZ}\quad\quad\={This is an example}\\
\entry{PQR}\>{This is an example}\\
\entry{ZXC}\>{This is an example}\\
\entry{CVN}\>{This is an example}\\
\end{tabbing}
\end{nomenclature}
%[...]
I ran into a similar issue when submitting a paper to an ASME journal. My solution was to edit the asme2e.cls file:
\newenvironment{nomenclature}{%
\newcommand\entry[2]{\noindent\hbox to 0.05\textwidth{##1}\ignorespaces##2\par}
\section*{Nomenclature}}{\par\addvspace{12pt}}
You can change the amount of indentation by changing "0.05\textwidth".
I'm not sure if this is what you're asking, but see the following MWE:
\documentclass[12pt]{article}
\newlength{\nomenlabelindent}
\setlength{\nomenlabelindent}{4em}
\newenvironment{nomenclature}{%
\newcommand\entry[2]{%
\hangindent\nomenlabelindent\noindent\makebox[\nomenlabelindent][l]{##1\quad}\ignorespaces##2\par}%
\section*{NOMENCLATURE}}{\par\addvspace{12pt}}
\begin{document}
\begin{nomenclature}
\entry{$A$} {Parameter}
\entry{$B$} {Parameter}
\entry{$C$}{Parameter}
\entry{$D$}{Parameter}
\entry{$E$}{Parameter}
\end{nomenclature}
\end{document}
Output:
Nomenclature
I've hit an annoying problem in LaTeX. I've got a tex file of about 1000 lines. I've already got a few figures, but when I try to add another figure, It barfs with:
! Undefined control sequence.
<argument> ... \sf#size \z# \selectfont \#currbox
l.937 \begin{figure}[t]
If I move the figure to other parts of the file, I can get similar errors on different lines:
! Undefined control sequence.
<argument> ... \sf#size \z# \selectfont \#currbox
l.657 \paragraph
{A Centering Algorithm}
If I comment out the figure, all is ok.
%\begin{figure}[t]
% \caption{Example decision tree, from Reiter and Dale [2000]}
% \label{fig:relation-decision-tree}
% \centering
% \includegraphics[keepaspectratio=true]{./relation-decision-tree.eps}
%\end{figure}
If I keep just the begin and end like:
\begin{figure}%[t]
% \caption{Example decision tree, from Reiter and Dale [2000]}
% \label{fig:relation-decision-tree}
% \centering
% \includegraphics[keepaspectratio=true]{./relation-decision-tree.eps}
\end{figure}
I get:
! Undefined control sequence.
<argument> ... \sf#size \z# \selectfont \#currbox
l.942 \end
{figure}
At first, I thought maybe LaTeX has hit some limit, and I tried playing with the ulimits, but that didn't help. Any ideas?
i've got other figures with graphics already. my preamble looks like:
\documentclass[acmcsur,acmnow]{acmtrans2n}
\usepackage{array}
\usepackage{lastpage}
\usepackage{pict2e}
\usepackage{amsmath}
\usepackage{varioref}
\usepackage{epsfig}
\usepackage{graphics}
\usepackage{qtree}
\usepackage{rotating}
\usepackage{tree-dvips}
\usepackage{mdwlist}
\makecompactlist{quote*}{quote}
\usepackage{verbatim}
\usepackage{ulem}
I found, not that it's a problem with \textsuperscript, but that it's with a ^ def I picked up from http://anthony.liekens.net/index.php/LaTeX/SubscriptAndSuperscriptInTextMode . The fix is to put the use of ^ in {}, as in I've put entire sections where I use lots of ^ and _ in {}. Hurrah!
During the end of my Master Thesis I also had the problem that after some amount of figures, I got an error without any special error message. After I read you thread, I also tried something with the packages included and in the end I was successful by taking out the \usepackage{pxfonts} and \usepackage{txfonts}. Yeah, finally.. I almost went crazy.. ;)
If I Google for "latex undefined control sequence" I get this.
I've successfully included a graphic into LaTeX using something like this:
\usepackage{amsmath,amsthm,graphicx}
...
I just wanted to test adding an image to a \LaTeX file:
\includegraphics[scale=0.60]{basic-info.png}
I typeset an entire dissertation of 200 pages with lots of figures in LaTeX and didn't run into a limit like that. I'd bet on a syntax problem first before I'd assume a size issue.
Your error lies elsewhere. I wouldn't be the least surprised if it turned out to be the document class. Try altering your document for \documentclass{article} and see where you get. If that fixes the problem you can complain to the ACM (ROTFLMAO—I've dealth with ACM).
If that doesn't fix, the problem, slip in a \tracingall somewhat before the offending figure or section, put the results into http://pastebin.com/, and let us know.
Please receive the thanks of a (formerly) utterly-confounded graduate student. Quick clarification for other users:
{The quickest ^{way} to put this solution into practice is to bracket all sections of text involving the character ``\^'' as shown here.}