1

I am new in this community and TeX. I am trying to add some equations in my TeX file with empheq package, I assume something is going on with the installation of the package, I am using Kile KDE editor.

These are the packages used:

     %% packages
    \usepackage[T1]{fontenc}
    \usepackage[utf8x]{inputenc}
    \usepackage{float}
    \usepackage{amsfonts,amssymb} % needed for math fonts
    %\usepackage[ruled,vlined,linesnumbered,resetcount,algochapter]{algorithm2e}
    \usepackage{amsmath} % needed for command eqref
    %\usepackage{mathtools}
    %\usepackage{algorithm}
    %\usepackage{algorithmic}
    %\usepackage{algorithmic}
    \usepackage{longtable}
    \usepackage{lmodern}
    %\usepackage{bookmark}
    %\usepackage{algpseudocode}
    %\usepackage{algcompatible}
    %
    \usepackage[greek,english]{babel}
    \usepackage{alphabeta}

    \usepackage[
        unicode
        ,colorlinks=true
        ,breaklinks
        %,greek
        ]{hyperref} % needed for creating hyperlinks in the document, the option colorlinks=true gets rid of the %awful %boxes, breaklinks breaks lonkg links (list of figures), and ngerman sets everything for german as %default hyperlinks %language
    %\usepackage[utf8]{inputenc}
    %\usepackage{bookmark}
    \usepackage{algpseudocode}

    %\usepackage[hyphenbreaks]{breakurl} % benötigt für das Brechen von URLs in Literaturreferenzen, hyphenbreaks auch bei %links, die über eine Seite gehen (mit hyphenation).
    \usepackage{xcolor}
    %\definecolor{c1}{rgb}{0,0,1} % blue
    %\definecolor{c2}{rgb}{0,0.3,0.9} % light blue
    %\definecolor{c3}{rgb}{0.3,0,0.9} % red blue%
    \hypersetup{
      colorlinks=True,
        linkcolor=blue, % internal links    
        citecolor=green!0.3!blue!0.9,
      urlcolor=red!0.3!blue!0.9} % external links/urls

    \usepackage{alphabeta}
\usepackage{algorithm, algcompatible}
\usepackage{empheq, nccmath} 
    %\usepackage{cite}          % needed for cite
    \usepackage[nottoc]{tocbibind}      % needed for displaying bibliography and other in the table of contents
    \usepackage[numbers, authoryear]{natbib}    % needed for cite and abbrvnat bibliography style
    \usepackage{graphicx}           % needed for \includegraphics 
    \usepackage{bigstrut}           % needed for the command \bigstrut
    \usepackage{enumerate}          % needed for some options in enumerate
    %\usepackage{todonotes}         % needed for todos
    %\usepackage{makeidx}           % needed for creating an index
    %\makeindex
    \newcommand\Mycite[1]{%
      \citeauthor{#1}~[\citeyear{#1}]}

This is the main TeX script:

\documentclass[a4paper, 12pt, openany]{book}

    \input{settings/packages}
    %\usepackage{algorithm, algcompatible}
    %\usepackage{empheq, nccmath} 
    \algnewcommand\INPUT{\item[\textbf{Input:}]}%
    \algnewcommand\OUTPUT{\item[\textbf{Output:}]}%

    %\input{settings/page}
    \graphicspath{{Images/}}
    \DeclareMathOperator*{\argmax}{argmax}
    %\makeglossaries

    %\input{settings/macros}
    %\newcommand{\imp}[1]{\underline{\textit{#1}}}
    %\input{Contents/abbreviations}
    \bibliographystyle{abbrvnat}
    %\setcitestyle{}
    %\setcounter{page}{4} 
    % Main document Below
    \begin{document}

    \pagestyle{empty}
    %\input{Contents/title_page} 
    \input{abstractGR}
    %\input{abstractEn}

    \pagestyle{plain}
    %\setotherlanguage{greek}
    %\selectlanguage{greek}
    \listoffigures
    \listoftables
    \tableofcontents
    \raggedbottom
    %\flushbottom
    %\clearpage\phantomsection
    %\selectlanguage{english}

    \pagebreak
    %\printglossary[type=\acronymtype,title=Abbreviations]
    % Insert dedication
    \vspace*{10cm}
    \centering{\large{\emph{\textgreek{ Στην Οικογενειά μου...} }}}
    \vfill
    \pagebreak

    \raggedright
    %\pagestyle{plain}
    %\input{chapters/introduction}
    %\input{chapters/modelSelection}
    %\input{chapters/post_process}
    %\chapter{}
    %\input{chapters/experiments}
    %\input{chapters/conclusion}
    %\appendix
    %\addtocontents{toc}{\contentsline{chapter}{\numberline{}APP}{}{}}
    %\addtocontents{toc}{\protect\contentsline{chapter}{Appendix}{}}
    %\input{chapters/appendix}
    %\addtocontents{toc}{\protect\contentsline{chapter}{\protect\numberline{}Appendix}{}{chapter*.\thepage}}

        %\newpage
        %\chapter{Introduction}

        \medskip
        %\citet*{*}
        %\cite{latexcompanion}
        %\bibliography{thesis}

        %\printindex

    \end{document}

abstractGR.tex file that includes empheq

\chapter*{\centering \textgreek{Περίληψη}}
%\addtocontents{toc}{\protect\contentsline{chapter}{\protect\numberline{}\textgreek{Περίληψη (Ελληνικά)}}{}{chapter*.%\thepage}}
%\addcontentsline{toc}{chapter}{Abstract (Greek)}
\textgreek{Η παρούσα διπλωματική εξετάζει το πρόβλημα της αναγνώρισης αντικειμένων από εικόνες, των οποίων τα πίξελ είναι ταξινομημένα σε μια από τις 19 κατηγορίες. Η εργασία χρησιμοποιεί μια βάση δεδομένων που αποτελείται από 19 διαφορετικές κατηγοριές αντικειμένων η οποία έχει δημιουργηθεί με χρήση κάμερας τοποθετημένη στο εμπρόσθιο μέρος του αυτοκινήτου. Οι εικόνες έχουν απαθανατιστεί από 50 διαφορετικές πόλεις της Ευρώπης σε διάφορες εποχές και καιρικές συνθήκες.\\

Με την χρήση πληροφορίας από εικόνες κατασκευάζουμε έναν ταξινομηττή ο οποίος μπορεί να αναγνωρίσει την κατηγορία αντικειμένων που ανήκει το κάθε πίξελ στην εικόνα ως συνάρτηση του μεγέθους των pixel αλλά και της δομής που απεικονίζουν. Για την ταξινόμηση χρησιμοποιήσαμε 2 πανομοιότυπα μοντέλα πλήρως συνελικτικών νευρωνικών δικτύων (}FCNNs\textgreek{) σε συνδυασμό με 2 διαφορετικά μοντέλα μετά επεξεργασίας. Το πρώτο μοντέλο κάνει χρήση του Μέσου Φίλτρου(}Median Filter\textgreek{), ενώ το δεύτερο κάνει χρήση μιας παραλλαγής του στατιστικού μοντέλου }CRF. \textgreek{Για την εικονοποίηση των παραπάνω αποτελεσμάτων υλοποιήθηκε λογισμικό που απεικονίζει τα αποτελέσματα των μεθόδων. Για την κατασκευή των παραπάνω μοντέλων γίνεται χρήση των βιβλιοθηκών }Scikit-learn, Keras \textgreek{ και} Tensorflow, \textgreek{ ενώ για την υλοποίηση του λογισμικού εικονοποίησης έγινε η χρήση της βιβλιοθήκης} pyQt.


\chapter*{\centering Abstract}
%\addtocontents{toc}{\protect\contentsline{chapter}{\protect\numberline{}Abstract (English)}{}{chapter*.\thepage}}

This thesis focuses the problem of recognizing objects from images whose images are classified in one of the 19 categories. The job uses a database consisting of 19 different categories of objects created using a camera located on the front of the car. Images have been recorded in 50 different European cities in different seasons and weather conditions.

Using information from images, we construct a classifier that can recognize the category of objects belonging to each image of the image as a function of the size of the pixels and the structure they represent. For classification, we used 2 identical Fully Convolutional Neural Networks in combination with 2 different models after editing. The first model uses Median Filter), while the latter uses a variation of the CRF statistical model. To illustrate the above results, we have implemented software that illustrates the results of the methods. To build the above models, we use Scikit-learn, Keras and Tensorflow, while using pyQt libraries.

\begin{empheq}{align} 
    \mathit{Loss(P,Q)} &= - \frac{1}{N} \sum_{x}^{N} P(x)\times 
    \log(Q(x)) \times \alpha_{\mathit{coefficients}}\\
    \nabla\times\overline{E}\notag
     &= -\frac{\partial\overline{B}}{\partial t}-\bar J_{\text{mi}} 
\end{empheq}

The empheq call is in the chapter abstractGR.tex from the one above, if I move the packages from the packages.tex to main.tex works like a charm.

  • 4
    (1) welcome, (2) instead if these sniplets, please post a full minimal example, that others can copy and test as is without having to add anything. – daleif Feb 16 '18 at 19:04
  • In addition to what @daleif is saying, could you check if some random MWE using empheq, e.g. this one, runs through? – user121799 Feb 16 '18 at 19:40
  • @marmot Yes, your example you linked is working... – Dimimal13 Feb 16 '18 at 19:50
  • Well, why don't you just adapt it, throw out unnecessary style files and replace the stuff between \begin{document} and \end{document} by your equation? Either it works or, if it does not work, people will have an MWE. – user121799 Feb 16 '18 at 19:53
  • emphes requires an argument: the name of a maths environment. You have commented out {align} in your code. – Bernard Feb 16 '18 at 19:53
2

UPDATE: Document class book works fine.

\documentclass{book}
\usepackage{empheq}
\usepackage{amsmath}
\usepackage{amssymb}

\begin{document}
    \begin{empheq}[left=\empheqlbrace]{align}
    \mathit{Loss(P,Q)} &= - \frac{1}{N} \sum_{x}^{N} P(x)\times 
    \log(Q(x)) \times \alpha_{\mathit{coefficients}}\\
    \nabla\times\overline{E}\notag
     &= -\frac{\partial\overline{B}}{\partial t}-\bar J_{\text{mi}} 
\end{empheq}
\end{document} 

enter image description here

I stole the {\mathit{coefficients} from @Zarko and replaced \bar by \overline because IMHO this looks better.

SECOND UPDATE: Your code had several option clashes. I think I solved all of them apart from those associated to babel and greek, which I never was able to run on my machine. For instance, you do not need definecolor in order to set the link etc. colors.

\documentclass{book}
%% packages
\usepackage{amsfonts,amssymb} % needed for math fonts
\usepackage{empheq, nccmath}
\usepackage{amsmath} % needed for command eqref
\usepackage{longtable}
\usepackage{lmodern}
\usepackage{xcolor}
\usepackage[unicode,
    ,colorlinks=true
    ,breaklinks
%    ,greek
    ]{hyperref}
\usepackage{bookmark}
\hypersetup{
  colorlinks=true,
  linkcolor=blue,
  citecolor=green!0.3!blue!0.9
  urlcolor=red!0.3!blue!0.9}
%\usepackage[greek,english]{babel}
\usepackage{alphabeta}
%%%
% \usepackage{} 
%\usepackage[utf8]{inputenc}
\usepackage{algpseudocode}
\usepackage{algorithm}
%\usepackage[hyphenbreaks]{breakurl} % benötigt für das Brechen von URLs in Literaturreferenzen, hyphenbreaks auch bei %links, die über eine Seite gehen (mit hyphenation).
 % needed for creating hyperlinks in the document, the option colorlinks=true gets rid of the %awful %boxes, breaklinks breaks lonkg links (list of figures), and ngerman sets everything for german as %default hyperlinks %language
% \definecolor{c1}{rgb}{0,0,1} % blue
% \definecolor{c2}{rgb}{0,0.3,0.9} % light blue
% \definecolor{c3}{rgb}{0.3,0,0.9} % red blue
% \hypersetup{
%     linkcolor={c1}, % internal links
%     citecolor={c2}, % citations
%     urlcolor={c3} % external links/urls
% }

%

\usepackage{alphabeta}
\usepackage[numbers, authoryear]{natbib}    % needed for cite and abbrvnat bibliography style
\usepackage[nottoc]{tocbibind}      % needed for displaying bibliography and other in the table of contents
\usepackage{graphicx}           % needed for \includegraphics 
\usepackage{bigstrut}           % needed for the command \bigstrut
\usepackage{enumerate}          % needed for some options in enumerate
% \newcommand\Mycite[1]{%
%   \citeauthor{#1}~[\citeyear{#1}]}
% 

    \begin{document}        
    \begin{empheq}[left=\empheqlbrace]{align}
            \mathit{Loss(P,Q)} = - \frac{1}{N} \sum_{x}^{N} P(x)\times log(Q(x)) \times \alpha_{coefficients}
            \nabla\times\bar E &= -\frac{\partial\bar B}{\partial t}-\bar J_{\text{mi}} 
        \end{empheq}
    \end{document}


    \documentclass{book}
\usepackage{empheq}
\usepackage{amsmath}
\usepackage{amssymb}

\begin{document}
    \begin{empheq}[left=\empheqlbrace]{align}
    \mathit{Loss(P,Q)} &= - \frac{1}{N} \sum_{x}^{N} P(x)\times 
    \log(Q(x)) \times \alpha_{\mathit{coefficients}}\\
    \nabla\times\overline{E}\notag
     &= -\frac{\partial\overline{B}}{\partial t}-\bar J_{\text{mi}} 
\end{empheq}
\end{document} 

enter image description here

I did not massage the equation here because I'm afraid of @Zarko ;-)

  • @marmot This is what i want to, i have updated the script, i guess some package conflicts with empheq... – Dimimal13 Feb 16 '18 at 20:30
2

You get an option clash for hyperref as you load bookmark at the start with no options, and that loads hyperref, so whenyou later load hyperref you get an error.

If you fix that by moving bookmarks then you get an error that hyperref does not have a greek option. Finally there is an error in the document that empheq requires an enviornment passed as the first option.

   \documentclass{book}
 %% packages
%\usepackage{xgreek}
%\usepackage[utf8]{inputenc}
\usepackage{amsfonts,amssymb} % needed for math fonts
\usepackage{empheq, nccmath}
%\usepackage[ruled,vlined,linesnumbered,resetcount,algochapter]{algorithm2e}
\usepackage{amsmath} % needed for command eqref
%\usepackage{mathtools}
%\usepackage{algorithm}
%\usepackage{algorithmic}
%\usepackage{algpseudocode}
%\usepackage{algcompatible}
%\usepackage{algorithmic}
%\usepackage[toc, appendix]{appendix}
\usepackage{longtable}
%\usepackage[utf8]{inputenc}
%\usepackage[acronym]{glossaries}
%%% Testt
%\usepackage[LGR,T1]{fontenc}
\usepackage{lmodern}

%
\usepackage[greek,english]{babel}
\usepackage{alphabeta}
%\usepackage[utf8]{inputenc}
%%%
\usepackage{algpseudocode}
\usepackage{algorithm}
\usepackage[
     unicode,
    ,colorlinks=true
    ,breaklinks
%    ,greek
    ]{hyperref} % needed for creating hyperlinks in the document, the option colorlinks=true gets rid of the %awful %boxes, breaklinks breaks lonkg links (list of figures), and ngerman sets everything for german as %default hyperlinks %language
%\usepackage[utf8]{inputenc}
\usepackage{bookmark}

\usepackage{empheq}
%\usepackage[hyphenbreaks]{breakurl} % benötigt für das Brechen von URLs in Literaturreferenzen, hyphenbreaks auch bei %links, die über eine Seite gehen (mit hyphenation).
\usepackage{xcolor}
\definecolor{c1}{rgb}{0,0,1} % blue
\definecolor{c2}{rgb}{0,0.3,0.9} % light blue
\definecolor{c3}{rgb}{0.3,0,0.9} % red blue
\hypersetup{
    linkcolor={c1}, % internal links
    citecolor={c2}, % citations
    urlcolor={c3} % external links/urls
}

%

\usepackage{alphabeta}
%\usepackage{cite}          % needed for cite
\usepackage[numbers, authoryear]{natbib}    % needed for cite and abbrvnat bibliography style
\usepackage[nottoc]{tocbibind}      % needed for displaying bibliography and other in the table of contents
\usepackage{graphicx}           % needed for \includegraphics 
%\usepackage{longtable}             % needed for long tables over pages
\usepackage{bigstrut}           % needed for the command \bigstrut
\usepackage{enumerate}          % needed for some options in enumerate
%\usepackage{todonotes}         % needed for todos
%\usepackage{makeidx}           % needed for creating an index
%\makeindex
\newcommand\Mycite[1]{%
  \citeauthor{#1}~[\citeyear{#1}]}
    \begin{document}        
    \begin{empheq}{align}%[left=\empheqlbrace]%{align}
            \mathit{Loss(P,Q)} = - \frac{1}{N} \sum_{x}^{N} P(x)\times log(Q(x)) \times \alpha_{coefficients}
            \nabla\times\bar E &= -\frac{\partial\bar B}{\partial t}-\bar J_{\text{mi}} 
        \end{empheq}
    \end{document}
  • Even with the align environment the problem resists... – Dimimal13 Feb 16 '18 at 21:16
  • @daleif When i uncomment the greek package in hyperref in David's MWE i get the following error: ! Package keyval Error: greek undefined. See the keyval package documentation for explanation. Type H <return> for immediate help. ... l.4319 \ProcessKeyvalOptions{Hyp} (/usr/share/texlive/texmf-dist/tex/latex/url/url.sty)) Package hyperref Message: Driver (autodetected): hpdftex. (/usr/share/texlive/texmf-dist/tex/latex/hyperref/hpdftex.def – Dimimal13 Feb 16 '18 at 21:30
  • @Dimmal13 yes exactly that is what I said, you get an error in the code that you posted as hyperref does not have a greek option, that is why I commented it out. – David Carlisle Feb 16 '18 at 21:37
  • We asked you whether David's example works on your system. Don't change it. Then you are basically wasting the time of the people trying to help you. – daleif Feb 16 '18 at 21:37
  • @Dimmal13 what do you mean by "the problem resists" ? the code I posted here runs without error. If you get an error then show the exact error that you get. – David Carlisle Feb 16 '18 at 21:38
2
\documentclass[a4paper,11pt]{book}
\usepackage{empheq, amssymb}

\usepackage[ unicode, ,colorlinks=true ,breaklinks % ,greek % <--- my instalation doesn't suport mee ]{hyperref}

\begin{document}
    \begin{empheq}[left=\empheqlbrace]{align}
\mathit{Loss}(P,Q)  & = - \frac{1}{N} \sum_{x}^{N} P(x)\times \log(Q(x)) \times \alpha_{\mathit{coefficients}}  \\
\nabla\times\bar{E} & = - \frac{\partial\bar{B}}{\partial t}-\bar{J}_{\mathrm{mi}}
    \end{empheq}
\end{document}
\end{empheq}

gives

enter image description here

is this what you looking for?

errors in your code snippet:

  • emheq had to have defined math style, which define fomr of equation (`align˙, which you comment out)
  • after first equation you forget on \\
  • i susspect that before equal sign in the first equation is missing ampersand
  • more correct is \bar{E}˛then \bar E etc
  • instead \text{mi} is correct \mathrm{mi}

edit: above mwe also works with hyperref package (i load it as last in preamble) compiled with xelatex.

  • 1
    I also updated the document class faster than you;-) And I adapted the \mathit{coefficients} from your answer, if that's OK with you, if not, I remove it. And I did not bit you, neither bite (since I am vegetarian) but beat. ;-) – user121799 Feb 16 '18 at 20:21
  • well, please not beat me :-). you just use anything from my answer what you find valuable. now i'm not sure (anymore), if i understood question correct :-(. anyway, here it is an will left it as it is. – Zarko Feb 16 '18 at 21:26
  • @Zarko you need a crystal ball to understand the question, none of us has found one yet:-) – David Carlisle Feb 16 '18 at 21:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.