eqn_html.c revision 260e9a87725c090ba5835b1f9f0b62fa2f96036f
260e9a87725c090ba5835b1f9f0b62fa2f96036fYuri Pankov/* $Id: eqn_html.c,v 1.10 2014/10/12 19:31:41 schwarze Exp $ */
260e9a87725c090ba5835b1f9f0b62fa2f96036fYuri Pankov * Copyright (c) 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
95c635efb7c3b86efc493e0447eaec7aecca3f0fGarrett D'Amore * Permission to use, copy, modify, and distribute this software for any
95c635efb7c3b86efc493e0447eaec7aecca3f0fGarrett D'Amore * purpose with or without fee is hereby granted, provided that the above
95c635efb7c3b86efc493e0447eaec7aecca3f0fGarrett D'Amore * copyright notice and this permission notice appear in all copies.
95c635efb7c3b86efc493e0447eaec7aecca3f0fGarrett D'Amore * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
95c635efb7c3b86efc493e0447eaec7aecca3f0fGarrett D'Amore * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
95c635efb7c3b86efc493e0447eaec7aecca3f0fGarrett D'Amore * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
95c635efb7c3b86efc493e0447eaec7aecca3f0fGarrett D'Amore * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
95c635efb7c3b86efc493e0447eaec7aecca3f0fGarrett D'Amore * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
95c635efb7c3b86efc493e0447eaec7aecca3f0fGarrett D'Amore * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
95c635efb7c3b86efc493e0447eaec7aecca3f0fGarrett D'Amore * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
260e9a87725c090ba5835b1f9f0b62fa2f96036fYuri Pankoveqn_box(struct html *p, const struct eqn_box *bp)
260e9a87725c090ba5835b1f9f0b62fa2f96036fYuri Pankov * Special handling for a matrix, which is presented to us in
260e9a87725c090ba5835b1f9f0b62fa2f96036fYuri Pankov * column order, but must be printed in row-order.
260e9a87725c090ba5835b1f9f0b62fa2f96036fYuri Pankov /* Estimate the number of rows, first. */
260e9a87725c090ba5835b1f9f0b62fa2f96036fYuri Pankov /* Print row-by-row. */
260e9a87725c090ba5835b1f9f0b62fa2f96036fYuri Pankov for (i = 0; i < rows; i++) {
260e9a87725c090ba5835b1f9f0b62fa2f96036fYuri Pankov for (j = 0; j < i; j++) {
260e9a87725c090ba5835b1f9f0b62fa2f96036fYuri Pankov * If we have no data for this
260e9a87725c090ba5835b1f9f0b62fa2f96036fYuri Pankov * particular cell, then print a
260e9a87725c090ba5835b1f9f0b62fa2f96036fYuri Pankov * placeholder and continue--don't puke.
260e9a87725c090ba5835b1f9f0b62fa2f96036fYuri Pankov if (bp->first != NULL && bp->first->type == EQN_LIST)
95c635efb7c3b86efc493e0447eaec7aecca3f0fGarrett D'Amoreprint_eqn(struct html *p, const struct eqn *ep)