@@ -206,20 +206,14 @@ void SpLatex::multiplot(size_t ln, size_t indent, const std::string& cmdline)
206206 bool title_mark = false ;
207207 bool ptitle_mark = false ;
208208
209- if (!groupfields.empty () && is_suffix (groupfields.back (), " =title" )) {
210- if (groupfields.size () != 1 ) {
211- OUT_THROW (" MULTIPLOT() has =title mark, but contains multiple columns." );
212- }
213- // remove =title from multiplot string
209+ if (!groupfields.empty () && is_suffix (groupfields.back (), " |title" )) {
210+ // remove |title from multiplot string
214211 groupfields.back ().resize (groupfields.back ().size () - 6 );
215212 multiplot.resize (multiplot.size () - 6 );
216213 title_mark = true ;
217214 }
218- else if (!groupfields.empty () && is_suffix (groupfields.back (), " =ptitle" )) {
219- if (groupfields.size () != 1 ) {
220- OUT_THROW (" MULTIPLOT() has =ptitle mark, but contains multiple columns." );
221- }
222- // remove =title from multiplot string
215+ else if (!groupfields.empty () && is_suffix (groupfields.back (), " |ptitle" )) {
216+ // remove |ptitle from multiplot string
223217 groupfields.back ().resize (groupfields.back ().size () - 7 );
224218 multiplot.resize (multiplot.size () - 7 );
225219 ptitle_mark = true ;
@@ -242,14 +236,16 @@ void SpLatex::multiplot(size_t ln, size_t indent, const std::string& cmdline)
242236 if (title_mark && !sql->exist_col (" title" ))
243237 OUT_THROW (" MULTIPLOT failed: title mark set but result contains no 'title' column." );
244238
245- if (ptitle_mark && !sql->exist_col (" title " ))
246- OUT_THROW (" MULTIPLOT failed: ptitle mark set but result contains no 'title ' column." );
239+ if (ptitle_mark && !sql->exist_col (" ptitle " ))
240+ OUT_THROW (" MULTIPLOT failed: ptitle mark set but result contains no 'ptitle ' column." );
247241
248242 unsigned int col_x = sql->find_col (" x" ), col_y = sql->find_col (" y" );
249243
250244 unsigned int col_title = 0 ;
251- if (title_mark || ptitle_mark )
245+ if (title_mark)
252246 col_title = sql->find_col (" title" );
247+ if (ptitle_mark)
248+ col_title = sql->find_col (" ptitle" );
253249
254250 // check existance of group fields and save ids
255251 std::vector<int > groupcols;
@@ -301,22 +297,22 @@ void SpLatex::multiplot(size_t ln, size_t indent, const std::string& cmdline)
301297
302298 lastgroup = rowgroup;
303299
304- // store group's legend string
305- std::ostringstream os ;
306- for ( size_t i = 0 ; i < groupcols. size (); ++i) {
307- if (i != 0 ) os << ' , ' ;
308- if (title_mark) {
309- os << escape_latex (sql-> text (col_title));
310- }
311- else if (ptitle_mark) {
312- os << sql-> text (col_title) ;
313- }
314- else {
300+ if (title_mark) {
301+ legendlist. push_back ( escape_latex (sql-> text (col_title))) ;
302+ }
303+ else if (ptitle_mark) {
304+ legendlist. push_back (sql-> text (col_title));
305+ }
306+ else {
307+ // store group's legend string
308+ std::ostringstream os ;
309+ for ( size_t i = 0 ; i < groupcols. size (); ++i) {
310+ if (i != 0 ) os << ' , ' ;
315311 os << escape_latex (groupfields[i]) << ' ='
316312 << escape_latex (rowgroup[i]);
317313 }
314+ legendlist.push_back (os.str ());
318315 }
319- legendlist.push_back (os.str ());
320316 }
321317
322318 // group fields match with last row -> append coordinates.
0 commit comments