I am trying to compile a document using lyx and the following line:

$Encrypted(k_\left\{subcontractor,airplane\right\}, softwareBytes | HMAC(softwareBytes))$

gives an error as if the first and second squiggly brackets are not closed even though running the same code here displays the intended output.



I've added the subscript braces:

$Encrypted(k_{\left\{subcontractor,airplane{\right\}}}, softwareBytes | HMAC(softwareBytes))$

In the online editor it works. In lyx the following errors are given:

Missing } inserted.
Extra }, or forgotten $
  • 1
    You have to use braces for subscripts: _{\left\{ \right\}} – Sigur Jan 26 '16 at 12:48
  • I have added them but the syntax error persists. The code is still valid in the online editor. – Sebi Jan 26 '16 at 12:55
  • 2
    Now it looks like you have an extra pair of braces around the \right\} – darthbith Jan 26 '16 at 12:56
  • 2
    Maybe you could be interested in \text{subcontractor} from amsmath package. – Sigur Jan 26 '16 at 13:01
  • 4
    please do not edit the question to contain the answer, the answer should be posted as an answer. – David Carlisle Jan 26 '16 at 13:08

the error message is due to missing braces around the subscript, but other non-reported errors are use of math-italic for words, and use of \left,\right in this context also \mid gives perhaps better spacing than |

enter image description here



$\mathrm{Encrypted}(k_{\{ \mathrm{subcontractor},\mathrm{airplane}\}}, \mathrm{softwareBytes} \mid \mathrm{HMAC}(\mathrm{softwareBytes}))$

  • 2
    May be \operatorname{Encrypted} and \operatorname{\textsc{hmac}} might be liked (or declaring \DeclareMathOperator\Encrypted{Encrypted} and \DeclareMathOperator\HMAC{\textsc{hmac}}). – Manuel Jan 26 '16 at 13:19
  • 1
    @Manuel I wondered about doing that but "one thing at a time" :-) – David Carlisle Jan 26 '16 at 13:24

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.