Re: centered formulas + \iff

2016-06-04 Thread Kiuhnm

On 04/06/2016 21:19, Paul A. Rubin wrote:

Kiuhnm  gmail.com> writes:


I'm using Lyx 2.1.4. I'd like to write a bunch of inequalities with an
\iff on the right side. The inequalities should be centered, like this:
 <=>
 <=>
<...>


Does the appended LyX file do what you want? I used the alignat environment,
and increased the number of columns to five. The left side of each
inequality goes in column 1, the inequality symbol in column 2, the right
side in column 4 and the iff symbol in column 5. Column 3 is intentionally
blank.


I came up with a (not so clean) solution:

#LyX 2.1 created this file. For more info see http://www.lyx.org/
\lyxformat 474
\begin_document
\begin_header
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\font_math auto
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Standard
\begin_inset Formula
\begin{align*}
\begin{gathered}H(Z)\leq\mathbb{E}_{Z}\lceil I(Z)\rceil<H(Z)+1\\
nH(X)\leq\mathbb{E}_{Z}\lceil I(Z)\rceil<nH(X)+1\\
H(X)\leq\frac{\mathbb{E}_{Z}\lceil I(Z)\rceil}{n}<H(X)+\frac{1}{n}.
\end{gathered}
 & \begin{gathered}\vphantom{H(Z)\leq\mathbb{E}_{Z}\lceil 
I(Z)\rceil<H(Z)+1}\iff\\

\vphantom{nH(X)\leq\mathbb{E}_{Z}\lceil I(Z)\rceil<nH(X)+1}\iff\\
\vphantom{H(X)\leq\frac{\mathbb{E}_{Z}\lceil 
I(Z)\rceil}{n}<H(X)+\frac{1}{n}.}

\end{gathered}
\end{align*}

\end_inset


\end_layout

\end_body
\end_document





Re: centered formulas + \iff

2016-06-04 Thread Kiuhnm

On 04/06/2016 21:19, Paul A. Rubin wrote:

Kiuhnm  gmail.com> writes:


I'm using Lyx 2.1.4. I'd like to write a bunch of inequalities with an
\iff on the right side. The inequalities should be centered, like this:
 <=>
 <=>
<...>


Does the appended LyX file do what you want? I used the alignat environment,
and increased the number of columns to five. The left side of each
inequality goes in column 1, the inequality symbol in column 2, the right
side in column 4 and the iff symbol in column 5. Column 3 is intentionally
blank.

Paul

#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 508


^^^ I had to edit this line because I have Lyx 2.1. I got some errors 
but I was able to load the file.


Anyway, I don't get the result I want. I'd like something like this:

   *<=>
    <=>
**  <=>
**

Basically, I need two cells the first of which centers its contents.
This is possible with eqnarray but then there are other issues 
(\frac{}{} doesn't work well, etc...).


Kiuhnm



Re: centered formulas + \iff

2016-06-06 Thread Kiuhnm

On 05/06/2016 22:41, Paul A. Rubin wrote:

Kiuhnm  gmail.com> writes:



I came up with a (not so clean) solution:



Try replacing everything between \begin_body and \end_body with the
following and see if it looks right:

\begin_layout Standard
\begin_inset Formula
\begin{alignat*}{3}
H(Z) & \leq\mathbb{E}_{Z}\lceil I(Z)\rceil &  & <H(Z)+1 & \iff\\
nH(X) & \leq\mathbb{E}_{Z}\lceil I(Z)\rceil &  & <nH(X)+1 & \iff\\
H(X) & \leq\frac{\mathbb{E}_{Z}\lceil I(Z)\rceil}{n} &  & <H(X)+\frac{1}{n}.
\end{alignat*}

\end_inset


\end_layout


It uses an alignat environment with three columns added (raising the total
from the default two to five), leaving the third column empty (so that the
last expressions before \iff align left rather than right).


Close, but not perfect. For the central part we need gather(ed). There's 
no escaping it. Compare:


\begin_body

\begin_layout Standard
\begin_inset Formula
\begin{alignat*}{3}
H(Z) & \leq\mathbb{E}_{Z}\lceil I(Z)\rceil &  & <H(Z)+1 & \iff\\
nH(X) & \leq\mathbb{E}_{Z}\lceil I(Z)\rceil &  & <nH(X)+1 & \iff\\
H(X) & \leq\frac{\mathbb{E}_{Z}\lceil I(Z)\rceil}{n} &  & <H(X)+\frac{1}{n}.
\end{alignat*}

\end_inset


\end_layout

\begin_layout Standard
\begin_inset Formula
\begin{alignat*}{2}
\begin{aligned}H(Z)\leq\vphantom{\mathbb{E}_{Z}\lceil I(Z)\rceil}\\
nH(X)\leq\vphantom{\mathbb{E}_{Z}\lceil I(Z)\rceil}\\
H(X)\leq\vphantom{\frac{\mathbb{E}_{Z}\lceil I(Z)\rceil}{n}}
\end{aligned}
 & \begin{gathered}\mathbb{E}_{Z}\lceil I(Z)\rceil\\
\mathbb{E}_{Z}\lceil I(Z)\rceil\\
\frac{\mathbb{E}_{Z}\lceil I(Z)\rceil}{n}
\end{gathered}
 & \begin{aligned} & \vphantom{\mathbb{E}_{Z}\lceil I(Z)\rceil}<H(Z)+1\\
 & \vphantom{\mathbb{E}_{Z}\lceil I(Z)\rceil}<nH(X)+1\\
 & \vphantom{\frac{\mathbb{E}_{Z}\lceil I(Z)\rceil}{n}}<H(X)+\frac{1}{n}.
\end{aligned}
 & \begin{gathered}\vphantom{\mathbb{E}_{Z}\lceil I(Z)\rceil}\iff\\
\vphantom{\mathbb{E}_{Z}\lceil I(Z)\rceil}\iff\\
\vphantom{\frac{\mathbb{E}_{Z}\lceil I(Z)\rceil}{n}}
\end{gathered}
\end{alignat*}

\end_inset


\end_layout

\end_body




centered formulas + \iff

2016-06-04 Thread Kiuhnm

Hi,

I'm using Lyx 2.1.4. I'd like to write a bunch of inequalities with an 
\iff on the right side. The inequalities should be centered, like this:

 <=>
 <=>
<...>
The problem with gather is that it only allows one column. If I insert a 
gathered environment and add a second column, it doesn't work.


Wouldn't it be simpler if Lyx let users decide the horizontal alignment 
on a column-by-column basis? I guess there are technical difficulties in 
doing this...




Re: Refresh child document preview

2016-06-16 Thread Kiuhnm

On 16/06/2016 21:55, Andrew Parsloe wrote:

On 17/06/2016 3:09 a.m., Guillaume Munch wrote:

Le 16/06/2016 15:21, Kiuhnm a écrit :

Hello,

I put a child document (TikZ file) inside a "preview box" and I can see
the image inline. The problem is that if I change the child document,
the preview is not updated. Restarting LyX (2.2.0) or reinserting the
child document solves the problem, but that's very tedious. Is there a
more convenient way?



For now, change zoom? (e.g. Ctrl+Mouse wheel)

I've recently discovered this trick, but prefer to do it in a more
systematic way. I've created a command sequence shortcut:

command-sequence buffer-zoom-in; buffer-zoom-out

and associated it with a shortcut key (Tools > Preferences > Editing >
Shortcuts). In fact I've used Alt+Z for no particular reason. This
leaves your screen font at exactly the same size as before but gets all
the previews refreshed.

Andrew


This is perfect! Thank you.

Kiuhnm



Lyx 2.2 and spaces before displaymath

2016-06-17 Thread Kiuhnm

Hello,

I wrote a document in Lyx 2.2 and I noticed that I had added extra empty 
lines before displaymath elements all over the document.


This happens when one hits return before pressing Ctrl+Shift+M. Did this 
happen in Lyx 2.1.4 too? I never noticed. Should this behavior be 
considered a feature or a bug?


Kiuhnm



Refresh child document preview

2016-06-16 Thread Kiuhnm

Hello,

I put a child document (TikZ file) inside a "preview box" and I can see 
the image inline. The problem is that if I change the child document, 
the preview is not updated. Restarting LyX (2.2.0) or reinserting the 
child document solves the problem, but that's very tedious. Is there a 
more convenient way?


Kiuhnm



pseudocode

2016-08-14 Thread Kiuhnm

Hello,

I'd like to insert some pseudocode in my paper using my own style. For 
instance, I don't like "endwhile", "endif", and similar.

Here's an example of what I'd like (use a monospaced font):

  for $I_1$:
for $I_2$:
  $X_{I_1}\leftarrow 

I usually use the enumerate environment (with the enumitem module) for 
this but this time I got the error "nested too deep". And, frankly, 
enumerate is not very convenient for algorighms because one needs to 
change the spacing, hide the labels, etc...


Basically, I just need a way to indent lines the way I like and be able 
to use math.


Kiuhnm



Re: leftside superscript

2016-07-18 Thread Kiuhnm

On 18/07/2016 15:06, Steve Burnham wrote:



On Mon, Jul 18, 2016 at 7:33 AM Kiuhnm <kiuhnm2...@gmail.com
<mailto:kiuhnm2...@gmail.com>> wrote:

On 18/07/2016 13:25, Kiuhnm wrote:
> Hello,
>
> what's the best way to write leftside superscripts in Lyx (latest
> version) with /correct spacing/?

\prescript from mathtools seems to work well. It'd be great if leftside
prescripts were supported directly by Lyx.

Kiuhnm



Just type them the same way you would super scripts in LyX. If you
wanted 5 to the power of two it would be 5^2 if you wanted a 2 as a
prescript then ^2 5 or use the underscore for subscripts.That's what
works for me.


That's not a good solution because the spacing is wrong. Compare:

\begin_body

\begin_layout Standard
\begin_inset Formula
\[
f\times^{5}g^{4}\neq f\times\prescript{5}{} g^{4}
\]

\end_inset


\end_layout

\end_body




leftside superscript

2016-07-18 Thread Kiuhnm

Hello,

what's the best way to write leftside superscripts in Lyx (latest 
version) with /correct spacing/?


Kiuhnm



Re: leftside superscript

2016-07-18 Thread Kiuhnm

On 18/07/2016 13:25, Kiuhnm wrote:

Hello,

what's the best way to write leftside superscripts in Lyx (latest
version) with /correct spacing/?


\prescript from mathtools seems to work well. It'd be great if leftside 
prescripts were supported directly by Lyx.


Kiuhnm



Re: leftside superscript

2016-07-23 Thread Kiuhnm

On 18/07/2016 17:30, Guillaume Munch wrote:

Le 18/07/2016 16:25, Richard Heck a écrit :

On 07/18/2016 07:32 AM, Kiuhnm wrote:

On 18/07/2016 13:25, Kiuhnm wrote:

Hello,

what's the best way to write leftside superscripts in Lyx (latest
version) with /correct spacing/?


\prescript from mathtools seems to work well. It'd be great if
leftside prescripts were supported directly by Lyx.


I'd suggest you file an enhancement request for this at lyx.org/trac/.
It may not be too difficult.



What about using a LyX macro to encapsulate \prescript?


It works quite well. The trick is to use \prescript for the LaTeX part 
and {}^{\#1} for the LyX part, so it's easy to edit.


Kiuhnm



Re: pseudocode

2016-08-17 Thread Kiuhnm

On 14/08/2016 23:33, Richard Heck wrote:

On 08/14/2016 07:43 AM, Kiuhnm wrote:

Hello,

I'd like to insert some pseudocode in my paper using my own style. For
instance, I don't like "endwhile", "endif", and similar.
Here's an example of what I'd like (use a monospaced font):

  for $I_1$:
for $I_2$:
  $X_{I_1}\leftarrow 

I usually use the enumerate environment (with the enumitem module) for
this but this time I got the error "nested too deep". And, frankly,
enumerate is not very convenient for algorighms because one needs to
change the spacing, hide the labels, etc...

Basically, I just need a way to indent lines the way I like and be
able to use math.


Doesn't the listings environment allow this?


Here's an easy solution:

\begin_body

\begin_layout Standard
\begin_inset FormulaMacro
\newcommand{\tab}{\-\ \-\ \-\ }
{}
\end_inset


\end_layout

\begin_layout Standard
pokpokpokp
\end_layout

\begin_layout Standard
\begin_inset Formula $\tab$
\end_inset

ijijijij
\end_layout

\begin_layout Standard
\begin_inset Formula $\tab\tab$
\end_inset

sdfsdfsdf
\end_layout

\begin_layout Standard
\begin_inset Formula $\tab\tab\tab$
\end_inset

dfdfgdfdg
\end_layout

\end_body




Re: pseudocode

2016-08-17 Thread Kiuhnm

On 14/08/2016 23:33, Richard Heck wrote:

On 08/14/2016 07:43 AM, Kiuhnm wrote:

Hello,

I'd like to insert some pseudocode in my paper using my own style. For
instance, I don't like "endwhile", "endif", and similar.
Here's an example of what I'd like (use a monospaced font):

  for $I_1$:
for $I_2$:
  $X_{I_1}\leftarrow 

I usually use the enumerate environment (with the enumitem module) for
this but this time I got the error "nested too deep". And, frankly,
enumerate is not very convenient for algorighms because one needs to
change the spacing, hide the labels, etc...

Basically, I just need a way to indent lines the way I like and be
able to use math.


Doesn't the listings environment allow this?


I can't use math in listings and I don't like the monospaced font.

Kiuhnm



Re: pseudocode

2016-08-19 Thread Kiuhnm

On 19/08/2016 13:38, Helge Hafting wrote:

Den 17. aug. 2016 12:14, skrev Kiuhnm:


I can't use math in listings and I don't like the monospaced font.




The LyX-Code environment lets you indent with spaces, and you can use
math freely. The monospaced font is merely a default, you can override
it with a character style:

Mark your algorithmic text, Edit->Text Style->Customized...
Select Family:Roman or Family:Sans serif according to taste.

If you write lots of such algorithms, then the way to go is a custom
document class with LyX-Code redefined to the font you like. A custom
class take some work to set up, compare to the work of changing the font
on every algorithm.


This will do! Thank you.

Kiuhnm